【发布时间】:2019-12-27 00:03:59
【问题描述】:
我希望我的机器人与附加到它的消息的图像进行交互。它将获取图像并将其存储到自己。这样的代码怎么写?
这里是当前代码的一部分:
@bot.command()
async def hello(ctx):
await ctx.send(embeds)
仅此而已,我希望你能帮助我
【问题讨论】:
标签: python discord discord.py
我希望我的机器人与附加到它的消息的图像进行交互。它将获取图像并将其存储到自己。这样的代码怎么写?
这里是当前代码的一部分:
@bot.command()
async def hello(ctx):
await ctx.send(embeds)
仅此而已,我希望你能帮助我
【问题讨论】:
标签: python discord discord.py
您可以像这样重新发送图像:
@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)
【讨论】: