getChat method

Future<Chat> getChat(
  1. dynamic chatId
)

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