【问题标题】:Discord bot get photo from user messageDiscord bot 从用户消息中获取照片
【发布时间】:2021-07-19 23:00:55
【问题描述】:

嘿嘿 我只是想知道如何将图像发送到频道并让 Discord 机器人将图像添加到它可以发送的文件列表中。

我想创建一个 !meme 命令,您可以在其中通过发送照片并输入像 !add-meme 这样的命令来添加照片。当您发送 !meme 时,它​​会保存照片并随机显示一张照片

这可能吗?

【问题讨论】:

    标签: python image discord


    【解决方案1】:

    是的,这是可能的,但您需要了解 discord py 文档和对 python 的基本了解。

    @client.command() 
    async def readMessageURL(ctx):
        string = ctx.message.attachments[0]
        
     @client.command() 
        async def send(ctx):
          await TextChannel.send(file=discord.File('path/to/image.png')) #or
          await TextChannel.send(url=string))
    

    参考:

    【讨论】:

      猜你喜欢
      • 2022-12-09
      • 2021-12-12
      • 2020-08-25
      • 2020-08-17
      • 2023-03-03
      • 2019-07-04
      • 2022-11-17
      • 1970-01-01
      • 2022-01-14
      相关资源
      最近更新 更多