delete method

Future<void> delete()

Removes the current this from the MemberRoleManager's cache

Example :

final Role? role = guild.roles.cache.get('240561194958716924');
if (role != null) {
  await role.delete();
}

You can specify a reason for this action

Example :

await role.delete(reason: 'I will destroy this..');

You can't delete @everyone and managed roles.

Implementation

Future<void> delete () async {
  if (isManaged || label == '@everyone') {
    return;
  }

  Http http = ioc.singleton(Service.http);
  Response response = await http.destroy(url: "/guilds/${manager.guild.id}/roles/$id");

  if (response.statusCode == 200) {
    manager.cache.remove(id);
  }
}