delete method

Future<void> delete({
  1. String? reason,
})

Removes the current this from the EmojiManager's cache

Example :

final Emoji? emoji = guild.emojis.cache.get('240561194958716924');
if (emoji != null) {
  await emoji.delete();
}

You can specify a reason for this action

Example :

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

Implementation

Future<void> delete ({ String? reason }) async {
  Response response = await ioc.use<DiscordApiHttpService>().destroy(url: "/guilds/${manager.guild.id}/emojis/$id")
    .auditLog(reason)
    .build();

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