-
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from mircoianese/master
BOT Api v6.0
- Loading branch information
Showing
26 changed files
with
591 additions
and
41 deletions.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
library/src/main/java/com/pengrad/telegrambot/model/ChatAdministratorRights.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
package com.pengrad.telegrambot.model; | ||
|
||
import java.io.Serializable; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Mirco Ianese | ||
* 20 Apr 2022 | ||
*/ | ||
public class ChatAdministratorRights implements Serializable { | ||
|
||
private final static long serialVersionUID = 0L; | ||
|
||
private Boolean is_anonymous; | ||
private Boolean can_manage_chat; | ||
private Boolean can_delete_messages; | ||
private Boolean can_manage_video_chats; | ||
private Boolean can_restrict_members; | ||
private Boolean can_promote_members; | ||
private Boolean can_change_info; | ||
private Boolean can_invite_users; | ||
private Boolean can_post_messages; | ||
private Boolean can_edit_messages; | ||
private Boolean can_pin_messages; | ||
|
||
public Boolean isAnonymous() { | ||
return is_anonymous; | ||
} | ||
|
||
public Boolean canManageChat() { | ||
return can_manage_chat; | ||
} | ||
|
||
public Boolean canDeleteMessages() { | ||
return can_delete_messages; | ||
} | ||
|
||
public Boolean canManageVideoChats() { | ||
return can_manage_video_chats; | ||
} | ||
|
||
public Boolean canRestrictMembers() { | ||
return can_restrict_members; | ||
} | ||
|
||
public Boolean canPromoteMembers() { | ||
return can_promote_members; | ||
} | ||
|
||
public Boolean canChangeInfo() { | ||
return can_change_info; | ||
} | ||
|
||
public Boolean canInviteUsers() { | ||
return can_invite_users; | ||
} | ||
|
||
public Boolean canPostMessages() { | ||
return can_post_messages; | ||
} | ||
|
||
public Boolean canEditMessages() { | ||
return can_edit_messages; | ||
} | ||
|
||
public Boolean canPinMessages() { | ||
return can_pin_messages; | ||
} | ||
|
||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ChatAdministratorRights that = (ChatAdministratorRights) o; | ||
return is_anonymous == that.is_anonymous && | ||
can_manage_chat == that.can_manage_chat && | ||
can_delete_messages == that.can_delete_messages && | ||
can_manage_video_chats == that.can_manage_video_chats && | ||
can_restrict_members == that.can_restrict_members && | ||
can_promote_members == that.can_promote_members && | ||
can_change_info == that.can_change_info && | ||
can_invite_users == that.can_invite_users && | ||
can_post_messages == that.can_post_messages && | ||
can_edit_messages == that.can_edit_messages && | ||
can_pin_messages == that.can_pin_messages; | ||
|
||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(is_anonymous, can_manage_chat, can_delete_messages, can_manage_video_chats, can_restrict_members, can_promote_members, can_change_info, can_invite_users, can_post_messages, can_edit_messages, can_pin_messages); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ChatAdministratorRights{" + | ||
"is_anonymous=" + is_anonymous + | ||
", can_manage_chat=" + can_manage_chat + | ||
", can_delete_messages='" + can_delete_messages + '\'' + | ||
", can_manage_video_chats=" + can_manage_video_chats + | ||
", can_restrict_members=" + can_restrict_members + | ||
", can_promote_members=" + can_promote_members + | ||
", can_change_info=" + can_change_info + | ||
", can_invite_users=" + can_invite_users + | ||
", can_post_messages=" + can_post_messages + | ||
", can_edit_messages=" + can_edit_messages + | ||
", can_pin_messages=" + can_pin_messages + | ||
'}'; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
library/src/main/java/com/pengrad/telegrambot/model/MenuButton.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.pengrad.telegrambot.model; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Mirco Ianese | ||
* 20 Apr 2022 | ||
*/ | ||
public class MenuButton<T extends MenuButton<T>> implements Serializable { | ||
|
||
private final static long serialVersionUID = 0L; | ||
|
||
private final String type; | ||
|
||
public MenuButton(String type) { | ||
this.type = type; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
library/src/main/java/com/pengrad/telegrambot/model/MenuButtonCommands.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.pengrad.telegrambot.model; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Mirco Ianese | ||
* 20 Apr 2022 | ||
*/ | ||
public class MenuButtonCommands extends MenuButton<MenuButtonCommands> implements Serializable { | ||
|
||
private final static long serialVersionUID = 0L; | ||
|
||
public MenuButtonCommands() { | ||
super("commands"); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
library/src/main/java/com/pengrad/telegrambot/model/MenuButtonDefault.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.pengrad.telegrambot.model; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Mirco Ianese | ||
* 20 Apr 2022 | ||
*/ | ||
public class MenuButtonDefault extends MenuButton<MenuButtonDefault> implements Serializable { | ||
|
||
private final static long serialVersionUID = 0L; | ||
|
||
public MenuButtonDefault() { | ||
super("default"); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
library/src/main/java/com/pengrad/telegrambot/model/MenuButtonWebApp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.pengrad.telegrambot.model; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Mirco Ianese | ||
* 20 Apr 2022 | ||
*/ | ||
public class MenuButtonWebApp extends MenuButton<MenuButtonWebApp> implements Serializable { | ||
|
||
private final static long serialVersionUID = 0L; | ||
|
||
private String text; | ||
private WebAppInfo web_app_info; | ||
|
||
public MenuButtonWebApp(String text, WebAppInfo webAppInfo) { | ||
super("web_app"); | ||
this.text = text; | ||
this.web_app_info = webAppInfo; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
library/src/main/java/com/pengrad/telegrambot/model/SentWebAppMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.pengrad.telegrambot.model; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Mirco Ianese | ||
* 20 Apr 2022 | ||
*/ | ||
public class SentWebAppMessage implements Serializable { | ||
|
||
private final static long serialVersionUID = 0L; | ||
|
||
private String inline_message_id; | ||
|
||
public SentWebAppMessage() { | ||
this.inline_message_id = null; | ||
} | ||
|
||
public SentWebAppMessage(String inlineMessageId) { | ||
this.inline_message_id = inlineMessageId; | ||
} | ||
|
||
public String inlineMessageId() { | ||
return inline_message_id; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
SentWebAppMessage sentWebAppMessage = (SentWebAppMessage) o; | ||
|
||
return sentWebAppMessage != null ? inline_message_id.equals(sentWebAppMessage.inline_message_id) : sentWebAppMessage.inline_message_id == null; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return inline_message_id != null ? inline_message_id.hashCode() : 0; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SentWebAppMessage{" + | ||
"inline_message_id='" + inline_message_id + '\'' + | ||
'}'; | ||
} | ||
} |
Oops, something went wrong.