setChatPermissions method

Future<bool> setChatPermissions(
  1. dynamic chat_id,
  2. ChatPermissions permissions
)
inherited

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 can_restrict_members admin rights.

Returns True on success.

Implementation

Future<bool> setChatPermissions(
    dynamic chat_id, ChatPermissions permissions) 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('setChatPermissions');
  var body = <String, dynamic>{
    'chat_id': chat_id,
    'permissions': jsonEncode(permissions),
  };
  return await HttpClient.httpPost(requestUrl, body: body);
}