modifyRole method

Future<Role> modifyRole(
  1. String guildId,
  2. String roleId, {
  3. String? name = '',
  4. String? permissions = '',
  5. int? color = -1,
  6. bool? hoist,
  7. bool? mentionable,
})

Implementation

Future<Role> modifyRole(
  String guildId,
  String roleId, {
  String? name = '',
  String? permissions = '',
  int? color = -1,
  bool? hoist,
  bool? mentionable,
}) {
  var endpoint = '/guilds/$guildId/roles/$roleId';
  return _http.request(
    endpoint,
    converter: Role.fromJson,
    method: 'patch',
    body: {
      ...insertNotDefault('name', name, ''),
      ...insertNotDefault('permissions', permissions, ''),
      ...insertNotDefault('color', color, -1, str: true),
      ...insertNotNull('hoist', hoist),
      ...insertNotNull('mentionable', mentionable),
    },
  );
}