Discord.net 是否可以通过编程方式添加自定义服务器表情符号反应?
Discord.net is it possible programmatically add a custom server emoji reaction?
我想知道是否有办法添加属于我们服务器的自定义非标准表情符号。
这适用于例如:
var context = new SocketCommandContext(_client, message as SocketUserMessage);
await context.Message.AddReactionAsync(new Emoji("")).ConfigureAwait(false);
但这不起作用
var context = new SocketCommandContext(_client, message as SocketUserMessage);
await context.Message.AddReactionAsync(new Emoji(":MyCustomEmoji:")).ConfigureAwait(false);
问题
有没有办法添加在我们的服务器上使用的自定义表情符号?如果有请解释。
非标准表情符号由 Emote Class. Here's a link to the additional documentation
管理
This is directly taken from the documentation of the Emote Class linked above
public async Task SendAndReactAsync(ISocketMessageChannel channel)
{
var message = await channel.SendMessageAsync("I am a message.");
// Creates a Unicode-based emoji based on the Unicode string.
// This is effectively the same as new Emoji("").
var heartEmoji = new Emoji("\U0001f495");
// Reacts to the message with the Emoji.
await message.AddReactionAsync(heartEmoji);
// Parses a custom emote based on the provided Discord emote format.
// Please note that this does not guarantee the existence of
// the emote.
var emote = Emote.Parse("<:thonkang:282745590985523200>");
// Reacts to the message with the Emote.
await message.AddReactionAsync(emote);
}
A valid Emote format is <:emoteName:emoteId>. This can be obtained by escaping with a \ in front of the emote using the Discord chat client.
我想知道是否有办法添加属于我们服务器的自定义非标准表情符号。
这适用于例如:
var context = new SocketCommandContext(_client, message as SocketUserMessage);
await context.Message.AddReactionAsync(new Emoji("")).ConfigureAwait(false);
但这不起作用
var context = new SocketCommandContext(_client, message as SocketUserMessage);
await context.Message.AddReactionAsync(new Emoji(":MyCustomEmoji:")).ConfigureAwait(false);
问题
有没有办法添加在我们的服务器上使用的自定义表情符号?如果有请解释。
非标准表情符号由 Emote Class. Here's a link to the additional documentation
管理This is directly taken from the documentation of the Emote Class linked above
public async Task SendAndReactAsync(ISocketMessageChannel channel)
{
var message = await channel.SendMessageAsync("I am a message.");
// Creates a Unicode-based emoji based on the Unicode string.
// This is effectively the same as new Emoji("").
var heartEmoji = new Emoji("\U0001f495");
// Reacts to the message with the Emoji.
await message.AddReactionAsync(heartEmoji);
// Parses a custom emote based on the provided Discord emote format.
// Please note that this does not guarantee the existence of
// the emote.
var emote = Emote.Parse("<:thonkang:282745590985523200>");
// Reacts to the message with the Emote.
await message.AddReactionAsync(emote);
}
A valid Emote format is <:emoteName:emoteId>. This can be obtained by escaping with a \ in front of the emote using the Discord chat client.