Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code refactor #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .idea/TelegramApi.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 23 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-clean-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>

<build>
Expand All @@ -94,6 +112,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -117,7 +138,7 @@
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
<executions>
<execution>
<id>clean-project</id>
Expand All @@ -130,7 +151,7 @@
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/org/telegram/api/bot/TLAbsBot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.telegram.api.bot;

import org.telegram.api.photo.TLAbsPhoto;
import org.telegram.api.user.TLAbsUser;
import org.telegram.tl.TLObject;
import org.telegram.tl.TLVector;

/**
* The type TL abs photos.
*/
public abstract class TLAbsBot extends TLObject {
private int userId = 0;
public String description = "";

public int getUserId () {
return this.userId;
}

public String getDescription () {
return this.description;
}

public void setUserId (int userId) {
this.userId = userId;
}

public void setDescription (String description) {
this.description = description;
}
}
11 changes: 1 addition & 10 deletions src/main/java/org/telegram/api/bot/TLBotCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
* @brief TODO
* @date 07 of July of 2015
*/
public class TLBotCommand extends TLObject {
public class TLBotCommand extends TLAbsBot {
public static final int CLASS_ID = 0xc27ac8c7;

private String command;
private String description;

@Override
public int getClassId() {
Expand All @@ -33,14 +32,6 @@ public void setCommand(String command) {
this.command = command;
}

public String getDescription() {
return this.description;
}

public void setDescription(String description) {
this.description = description;
}

@Override
public void serializeBody(OutputStream stream) throws IOException {
StreamingUtils.writeTLString(this.command, stream);
Expand Down
19 changes: 1 addition & 18 deletions src/main/java/org/telegram/api/bot/TLBotInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,17 @@
* @brief TODO
* @date 07 of July of 2015
*/
public class TLBotInfo extends TLObject {
public class TLBotInfo extends TLAbsBot {
public static final int CLASS_ID = 0x98e81d3a;

private int userId;
private String description;
private TLVector<TLBotCommand> commands = new TLVector<>();

@Override
public int getClassId() {
return CLASS_ID;
}

public int getUserId() {
return this.userId;
}

public void setUserId(int userId) {
this.userId = userId;
}

public String getDescription() {
return this.description;
}

public void setDescription(String description) {
this.description = description;
}

public TLVector<TLBotCommand> getCommands() {
return this.commands;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @brief TODO
* @date 09 of April of 2016
*/
public class TLInlineBotSwitchPm extends TLObject {
public class TLInlineBotSwitchPm extends TLAbsBot {
public static final int CLASS_ID = 0x3c20629f;

private String text;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.telegram.api.functions.channels;

import org.telegram.api.input.chat.TLAbsInputChannel;
import org.telegram.api.input.chat.TLInputChannel;
import org.telegram.tl.StreamingUtils;
import org.telegram.tl.TLBool;
import org.telegram.tl.TLContext;
Expand All @@ -20,7 +21,7 @@ public class TLRequestChannelsReadHistory extends TLMethod<TLBool> {
*/
public static final int CLASS_ID = 0xcc104937;

private TLAbsInputChannel channel;
private TLInputChannel channel;
private int maxId;

/**
Expand Down Expand Up @@ -54,11 +55,11 @@ public void setMaxId(int maxId) {
this.maxId = maxId;
}

public TLAbsInputChannel getChannel() {
public TLInputChannel getChannel() {
return channel;
}

public void setChannel(TLAbsInputChannel channel) {
public void setChannel(TLInputChannel channel) {
this.channel = channel;
}

Expand All @@ -70,7 +71,7 @@ public void serializeBody(OutputStream stream)

public void deserializeBody(InputStream stream, TLContext context)
throws IOException {
this.channel = (TLAbsInputChannel) StreamingUtils.readTLObject(stream, context);
this.channel = (TLInputChannel) StreamingUtils.readTLObject(stream, context);
this.maxId = StreamingUtils.readInt(stream);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.telegram.api.channel.filters.TLAbsChannelMessagesFilter;
import org.telegram.api.input.chat.TLAbsInputChannel;
import org.telegram.api.input.chat.TLInputChannel;
import org.telegram.api.updates.channel.differences.TLAbsUpdatesChannelDifferences;
import org.telegram.tl.StreamingUtils;
import org.telegram.tl.TLContext;
Expand All @@ -18,7 +19,7 @@ public class TLRequestUpdatesGetChannelDifference extends TLMethod<TLAbsUpdatesC
private static final int FLAG_FORCE = 0x00000001; // 0

private int flags;
private TLAbsInputChannel channel;
private TLInputChannel channel;
private TLAbsChannelMessagesFilter filter;
private int pts;
private int limit;
Expand Down Expand Up @@ -55,11 +56,11 @@ public void setPts(int pts) {
this.pts = pts;
}

public TLAbsInputChannel getChannel() {
public TLInputChannel getChannel() {
return channel;
}

public void setChannel(TLAbsInputChannel channel) {
public void setChannel(TLInputChannel channel) {
this.channel = channel;
}

Expand Down Expand Up @@ -100,7 +101,7 @@ public void serializeBody(OutputStream stream)
public void deserializeBody(InputStream stream, TLContext context)
throws IOException {
this.flags = StreamingUtils.readInt(stream);
this.channel = StreamingUtils.readTLObject(stream, context, TLAbsInputChannel.class);
this.channel = (TLInputChannel) StreamingUtils.readTLObject(stream, context);
this.filter = StreamingUtils.readTLObject(stream, context, TLAbsChannelMessagesFilter.class);
this.pts = StreamingUtils.readInt(stream);
this.limit = StreamingUtils.readInt(stream);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
* @date 19 of September of 2015
*/
public abstract class TLAbsInputChannel extends TLObject{
public abstract int getChannelId();
/* Changes to be done in case of any other field needs to be added */
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.telegram.tl.StreamingUtils;
import org.telegram.tl.TLContext;
import org.telegram.tl.TLObject;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -13,7 +14,7 @@
* @brief Input channel
* @date 19 of September of 2015
*/
public class TLInputChannel extends TLAbsInputChannel {
public class TLInputChannel extends TLObject {
public static final int CLASS_ID = 0xafeb712e;

private int channelId;
Expand Down
Loading