【问题标题】:Discord bot can't send more than two emojisDiscord 机器人不能发送两个以上的表情符号
【发布时间】:2020-09-22 05:27:05
【问题描述】:

我目前正在开发我的不和谐机器人,该机器人与表情符号配合得很好。但不知何故,我不能让我的机器人写两个以上的表情符号。

这行得通:

case 'test':
embed = new Discord.MessageEmbed()
  .setColor(hexColor)
  .setDescription(`Two Emoji <:harold:620608308910358530> <a:nice:634785041762877441> ok.`)
message.channel.send(embed);
break;

表情符号像往常一样显示在不和谐聊天中。

但是,如果我使用更多表情符号,例如:

case 'test':
embed = new Discord.MessageEmbed()
  .setColor(hexColor)
  .setDescription(`Three Emoji <:harold:620608308910358530> <:harold:620608308910358530>  <a:nice:634785041762877441> ok.`)
message.channel.send(embed);
break;

Discord 自动将机器人的消息转换为:

Three Emoji :harold: :harold: :nice: ok.

因此不再显示实际的表情符号,只显示他们的名字和:

这会阻止我在一条消息中包含两个以上的自定义表情符号。有没有办法防止这种情况发生?或者这只是 Discord 方面的一个已知限制?

【问题讨论】:

    标签: discord discord.js


    【解决方案1】:

    使用自定义表情符号时,最好在使用之前获取自定义表情符号。

    case 'test':
    const haroldEmoji = client.emojis.cache.get('620608308910358530')
    const niceEmoji = client.emojis.cache.get('634785041762877441')
    
    embed = new Discord.MessageEmbed()
      .setColor(hexColor)
      .setDescription(`Three Emoji ${haroldEmoji} ${haroldEmoji} ${niceEmoji} ok.`)
    message.channel.send(embed);
    break;
    

    【讨论】:

    • 谢谢!我之前尝试在另一种情况下使用它。但事实证明,将表情符号与您的符号一起使用(${haroldEmoji})尤为重要。只需将其添加到字符串 ("a" + haroldEmoji) 中将起作用,并且仅输出名称或 ID。这就是让我离开那里的原因。再次非常感谢您。
    猜你喜欢
    • 1970-01-01
    • 2019-08-01
    • 1970-01-01
    • 2020-10-29
    • 2020-04-02
    • 2020-12-21
    • 1970-01-01
    • 2021-06-18
    • 2021-08-02
    相关资源
    最近更新 更多