我试图让机器人从服务器外部的表情符号中获取 url 并将其克隆到服务器中,其内容如下: ?cloneemoji“表情”
@commands.command(aliases = ['ce'])
async def cloneemoji(self, ctx, *, emoji: discord.Emoji):
await self.upload.Server(url='{}'.format(emoji.url))
答案 0 :(得分:0)
以下是大多数机器人用来代表命令作者发送表情符号的示例,
它只是创建一个 Webhook 并显示为机器人,但使用命令保留用户的用户名和个人资料图片,许多机器人如 NQN 使用这种方法,所以希望这能满足您的需求
@client.command()
async def emoji(ctx, *, emojis=None):
if emojis== None:
await ctx.send(
f'Please provide a message or emoji!')
return
webhook = await ctx.channel.create_webhook(name=ctx.author.name)
await webhook.send(
str(message),
username=ctx.author.name,
avatar_url=ctx.author.avatar_url)
webhooks = await ctx.channel.webhooks()
for webhook in webhooks:
await webhook.delete()