Update present api implementation to botapi v5.3
This commit is contained in:
@@ -139,20 +139,20 @@ sub getChatMember {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub kickChatMember {
|
sub banChatMember {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $args = shift || {};
|
my $args = shift || {};
|
||||||
|
|
||||||
my $token = $self->token || croak 'No token supplied to kickChatMember?';
|
my $token = $self->token || croak 'No token supplied to banChatMember?';
|
||||||
my $send_args = {};
|
my $send_args = {};
|
||||||
|
|
||||||
unless ($args->{chat_id}) {
|
unless ($args->{chat_id}) {
|
||||||
cluck 'No chat_id supplied to kickChatMember()';
|
cluck 'No chat_id supplied to banChatMember()';
|
||||||
return {'error' => 1};
|
return {'error' => 1};
|
||||||
}
|
}
|
||||||
|
|
||||||
unless ($args->{user_id}) {
|
unless ($args->{user_id}) {
|
||||||
cluck 'No user_id supplied to kickChatMember()';
|
cluck 'No user_id supplied to banChatMember()';
|
||||||
return {'error' => 1};
|
return {'error' => 1};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ sub kickChatMember {
|
|||||||
$send_args->{until_date} = $args->{until_date} if exists $args->{until_date};
|
$send_args->{until_date} = $args->{until_date} if exists $args->{until_date};
|
||||||
$send_args->{revoke_messages} = $args->{revoke_messages} if exists $args->{revoke_messages};
|
$send_args->{revoke_messages} = $args->{revoke_messages} if exists $args->{revoke_messages};
|
||||||
|
|
||||||
my $url = "https://api.telegram.org/bot${token}/kickChatMember";
|
my $url = "https://api.telegram.org/bot${token}/banChatMember";
|
||||||
my $api_response = $self->_post_request($url, $send_args);
|
my $api_response = $self->_post_request($url, $send_args);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -805,10 +805,10 @@ of Chat User.
|
|||||||
|
|
||||||
On error returns hash reference with error set to 1
|
On error returns hash reference with error set to 1
|
||||||
|
|
||||||
=head2 kickChatMember
|
=head2 banChatMember
|
||||||
|
|
||||||
This is the wrapper around the C<kickChatMember> API method. See
|
This is the wrapper around the C<banChatMember> API method. See
|
||||||
L<https://core.telegram.org/bots/api#kickchatmember>.
|
L<https://core.telegram.org/bots/api#banchatmember>.
|
||||||
|
|
||||||
Takes chat_id, and user_id as arguments. And optionally until_date and
|
Takes chat_id, and user_id as arguments. And optionally until_date and
|
||||||
revoke_messages.
|
revoke_messages.
|
||||||
|
|||||||
@@ -7,32 +7,58 @@ use Carp qw(cluck);
|
|||||||
|
|
||||||
$Teapot::Bot::Object::ChatMember::VERSION = '0.022';
|
$Teapot::Bot::Object::ChatMember::VERSION = '0.022';
|
||||||
|
|
||||||
has 'user';
|
# ChatMemberOwner
|
||||||
has 'status';
|
has 'user';
|
||||||
has 'custom_title'; # optional. Owner and administrators only.
|
has 'status';
|
||||||
has 'is_anonymous'; # Optional. Owner and administrators only.
|
has 'custom_title'; # optional. Owner and administrators only.
|
||||||
|
has 'is_anonymous'; # Optional. Owner and administrators only.
|
||||||
|
|
||||||
has 'can_be_edited'; # optional. Administrators only.
|
# ChatMemberAdministrator
|
||||||
has 'can_manage_chat'; # Optional. Administrators only. True, if the administrator can access the chat event
|
# has 'user';
|
||||||
|
# has 'status';
|
||||||
|
has 'can_be_edited'; # optional. Administrators only.
|
||||||
|
# has 'custom_title'; # optional. Owner and administrators only.
|
||||||
|
# has 'is_anonymous'; # Optional. Owner and administrators only.
|
||||||
|
has 'can_manage_chat'; # Optional. Administrators only. True, if the administrator can access the chat event
|
||||||
# log, chat statistics, message statistics in channels, see channel members, see
|
# log, chat statistics, message statistics in channels, see channel members, see
|
||||||
# anonymous administrators in supergroups and ignore slow mode. Implied by any other
|
# anonymous administrators in supergroups and ignore slow mode. Implied by any other
|
||||||
# administrator privilege
|
# administrator privilege
|
||||||
has 'can_post_messages'; # optional. Administrators only.
|
has 'can_post_messages'; # optional. Administrators only.
|
||||||
has 'can_edit_messages'; # optional. Administrators only.
|
has 'can_edit_messages'; # optional. Administrators only.
|
||||||
has 'can_delete_messages'; # optional. Administrators only.
|
has 'can_delete_messages'; # optional. Administrators only.
|
||||||
has 'can_manage_voice_chats'; # Optional. Administrators only. True, if the administrator can manage voice chats
|
has 'can_manage_voice_chats'; # Optional. Administrators only. True, if the administrator can manage voice chats
|
||||||
has 'can_restrict_members'; # optional. Administrators only.
|
has 'can_restrict_members'; # optional. Administrators only.
|
||||||
has 'can_promote_members'; # optional. Administrators only.
|
has 'can_promote_members'; # optional. Administrators only.
|
||||||
has 'can_change_info'; # optional. Administrators and restricted only.
|
has 'can_change_info'; # optional. Administrators and restricted only.
|
||||||
has 'can_invite_users'; # optional. Administrators and restricted only.
|
has 'can_invite_users'; # optional. Administrators and restricted only.
|
||||||
has 'can_pin_messages'; # optional. Administrators and restricted only.
|
has 'can_pin_messages'; # optional. Administrators and restricted only.
|
||||||
has 'is_member'; # optional. Restricted only.
|
|
||||||
has 'can_send_messages'; # optional. Restricted only.
|
# ChatMemberMember
|
||||||
has 'can_send_media_messages'; # optional. Restricted only.
|
# has 'status';
|
||||||
has 'can_send_polls'; # optional. Restricted only.
|
# has 'user';
|
||||||
has 'can_send_other_messages'; # optional. Restricted only.
|
|
||||||
has 'can_add_web_page_previews'; # optional. Restricted only.
|
# ChatMemberRestricted
|
||||||
has 'until_date'; # optional. Restricted and kicked only.
|
# has 'status';
|
||||||
|
# has 'user';
|
||||||
|
has 'is_member'; # optional. Restricted only.
|
||||||
|
# has 'can_change_info'; # optional. Administrators and 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_polls'; # optional. Restricted only.
|
||||||
|
has 'can_send_other_messages'; # optional. Restricted only.
|
||||||
|
has 'can_add_web_page_previews'; # optional. Restricted only.
|
||||||
|
has 'until_date'; # optional. Restricted and kicked only.
|
||||||
|
|
||||||
|
# ChatMemberLeft
|
||||||
|
# has 'status';
|
||||||
|
# has 'user';
|
||||||
|
|
||||||
|
# ChatMemberBanned
|
||||||
|
# has 'status';
|
||||||
|
# has 'user';
|
||||||
|
# has 'until_date'; # optional. Restricted and kicked only.
|
||||||
|
|
||||||
sub fields {
|
sub fields {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user