getChat method

Future<Chat> getChat(
  1. dynamic chat_id
)
inherited

Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).

Returns a Chat object on success.

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

Implementation

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