我正在制作一个discord机器人,我的一个功能是获取一个表情符号的源图像盗窃目的
我创建了一个简单的函数,用于获取命令中发送的表情符号的URL,并在聊天中返回该URL,该URL通过discord自动转换为表情符号源图像。太好了
但是!它在服务器外部的emojis上不起作用。服务器内部的Emojis工作得很好,包括动画,但是服务器外部的Emojis(静态和动画)不会返回
我目前的代码如下:
@bot.command(brief='Allows you to steal an emoji', description='Will return the image file for a requested emoji', usage='[emoji](can be from anywhere and animated if you have nitro)')
async def steal(ctx, emoji: discord.Emoji):
receivedcommand(ctx)
await ctx.send(emoji.url)
如何将此代码更改为不在bot所在服务器内的emojis?我想我得用身份证做些奇怪的事,但我不知道从哪里开始
帮忙
编辑:错误消息
Ignoring exception in command steal:
Traceback (most recent call last):
File "C:\Users\Vyladence\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Vyladence\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
await self.prepare(ctx)
File "C:\Users\Vyladence\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 789, in prepare
await self._parse_arguments(ctx)
File "C:\Users\Vyladence\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Users\Vyladence\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 552, in transform
return await self.do_conversion(ctx, converter, argument, param)
File "C:\Users\Vyladence\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 505, in do_conversion
return await self._actual_conversion(ctx, converter, argument, param)
File "C:\Users\Vyladence\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 451, in _actual_conversion
ret = await instance.convert(ctx, argument)
File "C:\Users\Vyladence\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\converter.py", line 723, in convert
raise EmojiNotFound(argument)
discord.ext.commands.errors.EmojiNotFound: Emoji "<:10_years:578822331766538240>" not found.
对于外部表情,您需要使用^{} :
如果你使用^{} ,你的机器人需要在表情符号来自的公会中
相关问题 更多 >
编程相关推荐