我想问的是,在给定特定事件/情况的情况下,如何使discord bot重新发送邮件中的所有附件
这是我的密码:
if "ngab" in message.content.lower():
content=message.content.lower()
final=content.replace("ngab",":ng::ab:")
if len(final)<=2000:
attc = message.attachments
ref = message.reference
await message.delete()
await message.channel.send(f'{message.author.mention}: {final}', reference=ref)
else:
await message.reply(f"kata mas discord kepanjangan :ng::ab: {message.author.mention}")
在这里,我已经将消息的附件保存到变量attc
中,但我仍然不知道如何通过bot重新发送附件。我翻遍了文档,尝试使用discord.File,这要求我先保存附件,这可能会使8年前的cpu结巴,然后我尝试了这个
if message.attachments:
for attachment in attc:
await message.channel.send(attachment.url)
虽然附件与邮件分开并逐个发送,但效果良好。那么如何让机器人一次发送所有信息呢
提前感谢任何帮助或只是阅读的人。请原谅我在这篇文章中犯的任何错误
我不知道你一下子说的是什么意思,你上传的每个附件都是它自己的消息,所以不管你是否使用
discord.File
,它都是两条不同的消息您只能发送一次。 此外,用户不能发送多个附件。 所以别介意
相关问题 更多 >
编程相关推荐