leaveChat method

Future<bool> leaveChat(
  1. dynamic chat_id
)
inherited

Use this method for your bot to leave a group, supergroup or channel

Returns True on success.

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

Implementation

Future<bool> leaveChat(dynamic chat_id) 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('leaveChat');
  var body = <String, dynamic>{'chat_id': chat_id};
  return await HttpClient.httpPost(requestUrl, body: body);
}