setChatPermissions method
Future<bool>
setChatPermissions(
- dynamic chatId,
- ChatPermissions permissions, {
- bool? useIndependentChatPermissions,
Use this method to set default chat permissions for all members
The bot must be an administrator in the group or a supergroup for this to work and must have the canRestrictMembers admin rights.
Returns True on success.
Implementation
Future<bool> setChatPermissions(dynamic chatId, ChatPermissions permissions,
{bool? useIndependentChatPermissions}) 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('setChatPermissions');
var body = <String, dynamic>{
'chat_id': chatId,
'permissions': jsonEncode(permissions),
'use_independent_chat_permissions': useIndependentChatPermissions,
};
return await HttpClient.httpPost(requestUrl, body: body);
}