Python Discord.py-reupload图像
我正在使用的库是discord.py重写 所以我在我的服务器上做了一个meme功能,我遇到了一个问题。这个问题是因为我的算法 当用户向#memes发送图像时:Python Discord.py-reupload图像,python,python-3.x,discord,python-3.6,discord.py-rewrite,Python,Python 3.x,Discord,Python 3.6,Discord.py Rewrite,我正在使用的库是discord.py重写 所以我在我的服务器上做了一个meme功能,我遇到了一个问题。这个问题是因为我的算法 当用户向#memes发送图像时: 创建并嵌入该附件的链接 发送嵌入 删除用户的消息 过了一段时间,链接过期了,看起来 我知道我必须做什么,但我不知道怎么做。 我需要bot重新加载映像并获得cdn.discordapp.com链接。这就是我如何让bot在嵌入中重新加载映像的方法 @bot.command() async def attach(self, ctx):
我需要bot重新加载映像并获得cdn.discordapp.com链接。这就是我如何让bot在嵌入中重新加载映像的方法
@bot.command()
async def attach(self, ctx):
f = await ctx.message.attachments[0].to_file()
embed = discord.Embed()
embed.set_image(url=f"attachment://{f.filename}")
await channel.send(file=f, embed=embed)
看到
bot.command
和self
在一起有点奇怪。这是在一个Cog
内吗?