pinChatMessage method

Future<bool> pinChatMessage(
  1. dynamic chat_id,
  2. int message_id, {
  3. bool? disable_notification,
})
inherited

Use this method to pin a message in a supergroup or a channel

The bot must be an administrator in the chat for this to work and must have the ‘can_pin_messages’ admin right in the supergroup or ‘can_edit_messages’ admin right in the channel.

Returns True on success.

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

Implementation

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