【问题标题】:How to send a message in discord.py如何在 discord.py 中发送消息
【发布时间】:2020-10-15 10:26:52
【问题描述】:

当用户键入命令时,如何发送正常消息?我试过使用@client.command 异步def ping 但它不起作用D:

【问题讨论】:

    标签: discord.py discord.py-rewrite


    【解决方案1】:

    这里ctx 是上下文,hi 是命令

    代码:

    @client.command
    async def hi(ctx):
        await ctx.send("Message which you want to send")
    

    【讨论】:

      【解决方案2】:

      如果有帮助,请将此作为指南

      @client.command
      async def ping(ctx):
      await ctx.send("Your message")
      

      【讨论】:

        【解决方案3】:

        您可以使用await ctx.send("Your message here"),确保您在@client.command 中传递了上下文。 如果你还有问题,请随时问我:)

        【讨论】:

          猜你喜欢
          • 2021-07-08
          • 2020-10-01
          • 2021-10-15
          • 2021-02-24
          • 2021-03-11
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-02-28
          相关资源
          最近更新 更多