unbanChatMember method

Future<bool> unbanChatMember(
  1. dynamic chatId,
  2. int userId, {
  3. bool? onlyIfBanned,
})

Use this method to unban a previously kicked user in a supergroup or channel

The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. Returns True on success.

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

Implementation

Future<bool> unbanChatMember(dynamic chatId, int userId,
    {bool? onlyIfBanned}) async {
  if (chatId is! String && chatId is! int) {
    return Future.error(TelegramException(
        'Attribute \'chatId\' can only be either type of String or int'));
  }
  var requestUrl = _apiUri('unbanChatMember');
  var body = <String, dynamic>{
    'chat_id': chatId,
    'user_id': userId,
    'only_if_banned': onlyIfBanned,
  };
  return await HttpClient.httpPost(requestUrl, body: body);
}