Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python (discord.py)如何使我的discord Bot从邮件中重新发送附件?_Python_Discord_Discord.py - Fatal编程技术网

Python (discord.py)如何使我的discord Bot从邮件中重新发送附件?

Python (discord.py)如何使我的discord Bot从邮件中重新发送附件?,python,discord,discord.py,Python,Discord,Discord.py,我想问的是,在给定特定事件/情况的情况下,如何使discord bot重新发送邮件中的所有附件 这是我的密码: if "ngab" in message.content.lower(): content=message.content.lower() final=content.replace("ngab",":ng::ab:") if len(final)<=2000:

我想问的是,在给定特定事件/情况的情况下,如何使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}")
虽然附件与邮件分开并逐个发送,但效果良好。那么如何让机器人一次发送所有信息呢


提前感谢任何帮助或只是阅读的人。请原谅我在这篇文章中所犯的任何错误。

我不确定你一下子说的是什么意思,你上传的每个附件都是它自己的消息,所以不管你是否使用了
discord.File
,它都是两条不同的消息。

你不能发送多次。 此外,用户不能发送多个附件。 所以别介意

            if message.attachments:
                for attachment in attc:    
                    await message.channel.send(attachment.url)