revokeChatInviteLink method

Future<ChatInviteLink> revokeChatInviteLink(
  1. dynamic chat_id,
  2. String invite_link
)
inherited

Use this method to revoke an invite link created by the bot

If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.

Returns the revoked invite link as ChatInviteLink object.

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

Implementation

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