【问题标题】:How to insert multiple arguments into the discord bot command python如何将多个参数插入discord bot命令python
【发布时间】:2021-02-01 19:37:29
【问题描述】:

我正在尝试让我的 discord 机器人执行一个文件,然后发送一条消息表明该文件已被执行,但是当我添加 ctx.send 命令时,它不会在服务器中发送。它确实执行了 bat 文件,但机器人没有发送一条消息说“Opening Discord”

async def discord(self, ctx):
  await os.system("discord.bat") 
  await ctx.send('Opening discord')

【问题讨论】:

    标签: python python-3.x discord discord.py


    【解决方案1】:

    问题是您不必等待os.system,因为它不是协程。

    以下是修改后的代码:

    async def discord(self, ctx):
        os.system("discord.bat") 
        await ctx.send('Opening discord')
    

    【讨论】:

      猜你喜欢
      • 2018-01-23
      • 2018-10-21
      • 2021-03-01
      • 2021-04-11
      • 1970-01-01
      • 2020-08-11
      • 2021-02-17
      • 2019-03-07
      • 2019-04-19
      相关资源
      最近更新 更多