我希望我的机器人与附加到它的消息的图像进行交互。它将获取图像并将其存储给自己。如何编写这样的代码?
这里是当前代码的一部分:
@bot.command()
async def hello(ctx):
await ctx.send(embeds)
仅此而已,我希望你能并且可以帮助我
您可以像这样重新发送图像:
@bot.command()
async def hello(ctx):
files = []
for file in ctx.message.attachments:
fp = BytesIO()
await file.save(fp)
files.append(discord.File(fp, filename=file.filename, spoiler=file.is_spoiler()))
await ctx.send(files=files)