Emoji - discord-php/DiscordPHP GitHub Wiki
Emojis are part of Guild (Server). See Reaction for Emoji react on a Message.
use Discord\Parts\Guild\Emoji;
An emoji object represents a custom emoji.
Requires GUILD_EMOJIS
intent
You must first get the Guild object to use the code below. Change 123123123123123123
below with the Emoji ID you want to retrieve
Cached, synchronous:
$emoji = $guild->emojis->get('id', '123123123123123123');
Emoji can be also retrieved from related objects:
-
Activity
$emoji = $activity->emoji;
emoji of the activity -
Reaction
$emoji = $reaction->emoji;
emoji of the reaction
If the code above returns null
, you may need to fetch it first (Promise, asynchronous):
$guild->emojis->fetch('123123123123123123')->then(function (Emoji $emoji) {
// ...
})->done();
https://discord.com/developers/docs/resources/emoji#get-guild-emoji