Discord.Net/docs/guides/emoji/samples/socket-emote-sample.cs

11 lines
388 B
C#
Raw Permalink Normal View History

2024-06-12 22:43:59 -07:00
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);
}