Skip to content

Commit

Permalink
Telegram Bot API 6.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadiducho committed Dec 6, 2023
1 parent 427558f commit 56cb72a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = 'com.cadiducho'
version = '6.8'
version = '6.9'
sourceCompatibility = JavaVersion.VERSION_11

java {
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/com/cadiducho/telegrambotapi/BotAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

/**
* Interface to build Telegrams Bots
* Telegram Bot API version 6.8
* Telegram Bot API version 6.9
*/
public interface BotAPI {

Expand Down Expand Up @@ -1224,12 +1224,19 @@ default Boolean restrictChatMember(Object chat_id, Long user_id, ChatPermissions
* @param can_restrict_members Pass True, if the administrator can restrict, ban or unban chat members
* @param can_pin_messages Pass True, if the administrator can pin messages, supergroups only
* @param can_promote_members Pass True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by him)
* @param can_post_stories Pass True if the administrator can post stories in the channel; channels only
* @param can_edit_stories Pass True if the administrator can edit stories posted by other users; channels only
* @param can_delete_stories Pass True if the administrator can delete stories posted by other users; channels only
* @param can_manage_topics Pass True if the user is allowed to create, rename, close, and reopen forum topics, supergroups only
* @return On success, True is returned.
* @throws com.cadiducho.telegrambotapi.exception.TelegramException if the method fails in Telegram servers
*/
Boolean promoteChatMember(Object chat_id, Long user_id, Boolean is_anonymous, Boolean can_manage_chat, Boolean can_change_info, Boolean can_post_messages, Boolean can_edit_messages,
Boolean can_delete_messages, Boolean can_manage_voice_chats, Boolean can_invite_users, Boolean can_restrict_members, Boolean can_pin_messages, Boolean can_promote_members, Boolean can_manage_topics) throws TelegramException;
Boolean promoteChatMember(Object chat_id, Long user_id, Boolean is_anonymous, Boolean can_manage_chat, Boolean can_change_info,
Boolean can_post_messages, Boolean can_edit_messages, Boolean can_delete_messages,
Boolean can_manage_voice_chats, Boolean can_invite_users,
Boolean can_restrict_members, Boolean can_pin_messages, Boolean can_promote_members,
Boolean can_post_stories, Boolean can_edit_stories, Boolean can_delete_stories,
Boolean can_manage_topics) throws TelegramException;

/**
* Use this method to set a custom title for an administrator in a supergroup promoted by the bot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ public class ChatAdministratorRights {
*/
@Json(name = "can_pin_messages") private Boolean canPinMessages;

/**
* Optional. True, if the administrator can post stories in the channel; channels only
*/
@Json(name = "can_post_stories") private Boolean canPostStories;

/**
* Optional. True, if the administrator can edit stories posted by other users; channels only
*/
@Json(name = "can_edit_stories") private Boolean canEditStories;

/**
* Optional. True, if the administrator can delete stories posted by other users; channels only
*/
@Json(name = "can_delete_stories") private Boolean canDeleteStories;

/**
* Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ public ChatMemberAdministrator(String status, User user) {
*/
@Json(name = "can_pin_messages") private Boolean canPinMessages;

/**
* Optional. True, if the administrator can post stories in the channel; channels only
*/
@Json(name = "can_post_stories") private Boolean canPostStories;

/**
* Optional. True, if the administrator can edit stories posted by other users; channels only
*/
@Json(name = "can_edit_stories") private Boolean canEditStories;

/**
* Optional. True, if the administrator can delete stories posted by other users; channels only
*/
@Json(name = "can_delete_stories") private Boolean canDeleteStories;

/**
* Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
*/
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/cadiducho/telegrambotapi/TelegramBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

/**
* Default implementation to build Telegrams Bots
* Telegram Bot API version 6.8
* Telegram Bot API version 6.9
*/
public class TelegramBot implements BotAPI {

Expand Down Expand Up @@ -682,7 +682,7 @@ public Boolean restrictChatMember(Object chat_id, Long user_id, ChatPermissions
}

@Override
public Boolean promoteChatMember(Object chat_id, Long user_id, Boolean is_anonymous, Boolean can_manage_chat, Boolean can_change_info, Boolean can_post_messages, Boolean can_edit_messages, Boolean can_delete_messages, Boolean can_manage_video_chats, Boolean can_invite_users, Boolean can_restrict_members, Boolean can_pin_messages, Boolean can_promote_members, Boolean can_manage_topics) throws TelegramException {
public Boolean promoteChatMember(Object chat_id, Long user_id, Boolean is_anonymous, Boolean can_manage_chat, Boolean can_change_info, Boolean can_post_messages, Boolean can_edit_messages, Boolean can_delete_messages, Boolean can_manage_video_chats, Boolean can_invite_users, Boolean can_restrict_members, Boolean can_pin_messages, Boolean can_promote_members, Boolean can_post_stories, Boolean can_edit_stories, Boolean can_delete_stories, Boolean can_manage_topics) throws TelegramException {
Object safeChatId = getSafeChatId(chat_id);
final MultipartBody.Builder parameters = bodyBuilder();

Expand All @@ -700,6 +700,9 @@ public Boolean promoteChatMember(Object chat_id, Long user_id, Boolean is_anonym
safeAdd(parameters, "can_pin_messages", can_pin_messages);
safeAdd(parameters, "can_promote_members", can_promote_members);
safeAdd(parameters, "can_manage_topics", can_manage_topics);
safeAdd(parameters, "can_post_stories", can_post_stories);
safeAdd(parameters, "can_edit_stories", can_edit_stories);
safeAdd(parameters, "can_delete_stories", can_delete_stories);

final Request request = new Request.Builder()
.url(apiUrl + "promoteChatMember")
Expand Down

0 comments on commit 56cb72a

Please sign in to comment.