revokeChatInviteLink method

Future<ChatInviteLink> revokeChatInviteLink(
  1. dynamic chatId,
  2. String inviteLink
)

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