python - 通过 dms discord.py 发送动画表情符号
问题描述
我见过很多不和谐的机器人使用动画表情符号来攻击我。我了解如何在服务器中发送动画表情符号,因为表情符号在服务器中。但是他们怎么能用动画表情符号给我发短信呢?我想在用户进行验证时发送 dm,机器人回复 dm 说:“您已通过验证!” 带有表情符号。
@bot.command()
async def verify(ctx):
helpembed=discord.Embed(title="Verification", url=" ", description="You have been verified!", color=discord.Color.blue())
await ctx.author.send(embed=helpembed)
解决方案
Discord 对自定义和动画表情符号使用特殊模式(就像它对频道提及和用户提及所做的那样)。
animated_emoji = "<a:emoji_name:emoji_id>"
custom_emoji = "<:emoji_name:emoji_id>"
如果您有表情符号 ID,这将适用于自定义和动画表情符号:( client.get_emoji )
emoji = bot.get_emoji(emoji_id)
await ctx.send("Hello! {}".format(emoji))
如果你有它的名字和公会表情符号来自:(utils.get,guild.emojis)
from discord import utils
emoji = utils.get(guild.emojis, name="my emoji name")
await ctx.send("Hello! {}".format(emoji))
参考:
推荐阅读
- javascript - 如何使用带有锚标记的数组中随机选择的 URL 链接
- javascript - 反应:在 safari 上超过了最大更新深度
- javascript - 请求失败。输入字符串的格式不正确。更新列表 Sharepoint
- sql - 在创建表时使用外键检查另一个表的属性值
- xml - 带有 XSL 的 XML 从平面 xml 生成分层 xml
- docker - 绑定挂载目录时'rw'是什么意思
- windows - 挂钩 SSDT 后在将参数传递给 NtWriteFile 之前修改参数
- javascript - 来自 javascript 的 AngularJS v1.4 函数调用
- android - 我在 Flutter 中遇到了一个问题:在构建 TextField 时抛出了以下断言,它使我遇到了一个奇怪的问题
- javascript - 使 location.replace() 与 javascript keypress 事件处理程序中的表单输入一起工作