Discord.Net/docs/guides/emoji/samples/socket-emote-sample.cs
2024-06-13 17:43:59 +12:00

11 lines
No EOL
388 B
C#

private readonly DiscordSocketClient _client;
public async Task ReactAsync(SocketUserMessage userMsg, string emoteName)
{
var emote = _client.Guilds
.SelectMany(x => x.Emotes)
.FirstOrDefault(x => x.Name.IndexOf(
emoteName, StringComparison.OrdinalIgnoreCase) != -1);
if (emote == null) return;
await userMsg.AddReactionAsync(emote);
}