leaveChat method

Future<bool> leaveChat(
  1. dynamic chatId
)

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