promoteChatMember method

Future<bool> promoteChatMember(
  1. dynamic chat_id,
  2. int user_id, {
  3. bool? is_anonymous,
  4. bool? can_manage_chat,
  5. bool? can_post_messages,
  6. bool? can_edit_messages,
  7. bool? can_delete_messages,
  8. bool? can_manage_voice_chats,
  9. bool? can_restrict_members,
  10. bool? can_promote_members,
  11. bool? can_change_info,
  12. bool? can_invite_users,
  13. 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.

https://core.telegram.org/bots/api#promotechatmember

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);
}