approveChatJoinRequest method

Future<bool> approveChatJoinRequest(
  1. dynamic chatId,
  2. int userId
)

Use this method to approve a chat join request

The bot must be an administrator in the chat for this to work and must have the canInviteUsers administrator right.

Returns True on success.

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

Implementation

Future<bool> approveChatJoinRequest(dynamic chatId, int userId) 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('approveChatJoinRequest');
  var body = <String, dynamic>{
    'chat_id': chatId,
    'user_id': userId,
  };
  return await HttpClient.httpPost(requestUrl, body: body);
}