promoteChatMember method
Future<bool>
promoteChatMember(
- dynamic chat_id,
- int user_id, {
- bool? is_anonymous,
- bool? can_manage_chat,
- bool? can_post_messages,
- bool? can_edit_messages,
- bool? can_delete_messages,
- bool? can_manage_voice_chats,
- bool? can_restrict_members,
- bool? can_promote_members,
- bool? can_change_info,
- bool? can_invite_users,
- bool? can_pin_messages,
inherited
Use this method to promote or demote a user in a supergroup or a channel
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user. Returns True on success.
Implementation
Future<bool> promoteChatMember(dynamic chat_id, int user_id,
{bool? is_anonymous,
bool? can_manage_chat,
bool? can_post_messages,
bool? can_edit_messages,
bool? can_delete_messages,
bool? can_manage_voice_chats,
bool? can_restrict_members,
bool? can_promote_members,
bool? can_change_info,
bool? can_invite_users,
bool? can_pin_messages}) async {
if (chat_id is! String && chat_id is! int) {
return Future.error(TelegramException(
'Attribute \'chat_id\' can only be either type of String or int'));
}
var requestUrl = _apiUri('promoteChatMember');
var body = <String, dynamic>{
'chat_id': chat_id,
'user_id': user_id,
'is_anonymous': is_anonymous,
'can_manage_chat': can_manage_chat,
'can_post_messages': can_post_messages,
'can_edit_messages': can_edit_messages,
'can_delete_messages': can_delete_messages,
'can_manage_voice_chats': can_manage_voice_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_pin_messages': can_pin_messages,
};
return await HttpClient.httpPost(requestUrl, body: body);
}