createChatInviteLink method
Use this method to create an additional invite link for a chat
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The link can be revoked using the method revokeChatInviteLink.
Returns the new invite link as ChatInviteLink object.
Implementation
Future<ChatInviteLink> createChatInviteLink(dynamic chatId,
{String? name,
int? expireDate,
int? memberLimit,
bool? createsJoinRequest}) 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('createChatInviteLink');
var body = <String, dynamic>{
'chat_id': chatId,
'name': name,
'expire_date': expireDate,
'member_limit': memberLimit,
'creates_join_request': createsJoinRequest,
};
return ChatInviteLink.fromJson(
await HttpClient.httpPost(requestUrl, body: body));
}