![](/img/trans.png)
[英]How to get a emoji by name, not ID and add it to the message? discord.py
[英]how to get discord emoji name and id with command?
我正在尝试编写一个迷你机器人,通过 discord 命令仅向您显示表情符号的名称和 ID,但我遇到了一个小问题,我使用的代码仅向我显示了当前在服务器上的所有表情符号,并且仅显示我想从表情符号列表中显示一个表情符号名称和 ID select
这是向我展示的内容:
https://i.imgur.com/jrIv2jX.png
我只想出现一个
示例::emoji + 服务器表情符号图标:
https://i.imgur.com/9O6JkJB.png
这是我现在正在使用的代码:
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!', description="ayuda bot")
bot.remove_command("help")
@bot.command()
async def emojis(ctx):
for emoji in ctx.guild.emojis:
await ctx.send(f"{emoji.name} {emoji.id}")
@bot.event
async def on_ready():
print("BOT listo!")
bot.run('')
能帮帮我吗,万分感谢!
很抱歉这样放置图像,它不能让我正确放置它们
您的帖子中的信息有限,但看起来最有可能的罪魁祸首是您的代码是 for each 循环。 这部分:
async def emojis(ctx):
for emoji in ctx.guild.emojis:
await ctx.send(f"{emoji.name} {emoji.id}")
等待每个表情符号被发送。 如果你只想要一个,你可能只想打印你拿回来的第一个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.