Add partial BotAPI v6.5 support

This commit is contained in:
eleksir
2023-04-16 16:31:12 +03:00
parent ecf4f94dca
commit f019b98b1f
3 changed files with 27 additions and 13 deletions

View File

@@ -311,9 +311,9 @@ sub muteChatMember {
$send_args->{chat_id} = $args->{chat_id};
$send_args->{user_id} = $args->{user_id};
$send_args->{until_date} = $args->{until_date} if exists $args->{until_date};
# Revoke all known for API v6.2 permissions
# Revoke all known for API v6.4 permissions
$send_args->{permissions}->{can_send_messages} = false;
$send_args->{permissions}->{can_send_media_messages} = false;
$send_args->{permissions}->{use_independent_chat_permissions} = false; # https://core.telegram.org/bots/api#restrictchatmember
$send_args->{permissions}->{can_send_polls} = false;
$send_args->{permissions}->{can_send_other_messages} = false;
$send_args->{permissions}->{can_add_web_page_previews} = false;

View File

@@ -53,7 +53,12 @@ has 'is_member'; # optional. Restricted only.
# has 'can_invite_users'; # optional. Administrators and restricted only.
# has 'can_pin_messages'; # optional. Administrators and restricted only.
has 'can_send_messages'; # optional. Restricted only.
has 'can_send_media_messages'; # optional. Restricted only.
has 'can_send_audios';
has 'can_send_documents';
has 'can_send_photos';
has 'can_send_videos';
has 'can_send_video_notes';
has 'can_send_voice_notes';
has 'can_send_polls'; # optional. Restricted only.
has 'can_send_other_messages'; # optional. Restricted only.
has 'can_add_web_page_previews'; # optional. Restricted only.
@@ -71,11 +76,14 @@ has 'until_date'; # optional. Restricted and kicked only.
sub fields {
return {
'scalar' => [qw/status custom_title is_anonymous can_be_edited can_manage_chat can_post_messages
can_edit_messages can_delete_messages can_manage_voice_chats can_restrict_members
can_promote_members can_change_info can_invite_users can_pin_messages is_member
can_send_messages can_send_media_messages can_send_polls can_send_other_messages
can_add_web_page_previews until_date can_manage_topics/],
'scalar' => [qw/status custom_title is_anonymous can_be_edited can_manage_chat
can_post_messages can_edit_messages can_delete_messages
can_manage_voice_chats can_restrict_members can_promote_members
can_change_info can_invite_users can_pin_messages is_member
can_send_messages can_send_audios can_send_documents can_send_photos
can_send_videos can_send_video_notes can_send_voice_notes can_send_polls
can_send_other_messagescan_add_web_page_previews until_date
can_manage_topics/],
'Teapot::Bot::Object::User' => [qw/user/],
};
}

View File

@@ -15,8 +15,12 @@ $Teapot::Bot::Object::ChatPermissions::VERSION = '0.025';
# all fields are optional
# N.B. Some of the fields "overlaps" other, so in order to guess valid set of permissions you should check all of them
has 'can_send_messages'; # True, if the user is allowed to send text messages, contacts, locations and venues
has 'can_send_media_messages'; # True, if the user is allowed to send audios, documents, photos, videos, video notes
# and voice notes, implies can_send_messages
has 'can_send_audios'; # True, if the user is allowed to send audios
has 'can_send_documents'; # True, if the user is allowed to send documents
has 'can_send_photos'; # True, if the user is allowed to send photos
has 'can_send_videos'; # True, if the user is allowed to send videos
has 'can_send_video_notes'; # True, if the user is allowed to send video_notes
has 'can_send_voice_notes'; # True, if the user is allowed to send voice_notes
has 'can_send_polls'; # True, if the user is allowed to send polls, implies can_send_messages
has 'can_send_other_messages'; # True, if the user is allowed to send animations, games, stickers and use inline bots,
# implies can_send_media_messages
@@ -31,9 +35,11 @@ has 'can_manage_topics'; # Optional. True, if the user is allowed to cre
sub fields {
return {
'scalar' => [qw/can_send_messages can_send_media_messages can_send_polls
can_send_other_messages can_add_web_page_previews can_change_info
can_invite_users can_pin_messages can_manage_topics/],
'scalar' => [qw/can_send_messages can_send_audios can_send_documents
can_send_photos can_send_videos can_send_video_notes
can_send_voice_notes can_send_polls can_send_other_messages
can_add_web_page_previews can_change_info can_invite_users
can_pin_messages can_manage_topics/],
};
}