如何使用自定义表情符号?

时间:2019-11-02 16:14:57

标签: c# emoji discord.net

我一直在尝试在嵌入的消息中使用自定义表情符号,但是没有用

我尝试使用Emoji甚至Emote,但它们都不起作用

var questionMark = new Emoji("<:questionmark:640216780689637390>");
await ReplyAsync($"{questionMark}");

如果我这样做,它只会显示“:questionmark:”,而不显示表情符号,我希望表情符号显示出来

2 个答案:

答案 0 :(得分:0)

在表情符号类中,您无需输入“ <”和“>”。所以你的代码应该像这样

var questionMark = new Emoji(":questionmark:640216780689637390");
await ReplyAsync($"{questionMark}");

答案 1 :(得分:0)

docs粘贴的副本

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);
}