【问题标题】:Discord bot to say specific thing on specific inputDiscord 机器人在特定输入上说出特定内容
【发布时间】:2020-11-18 19:29:22
【问题描述】:

我在 python 中为 discord 编写了一个小机器人,并开始使用简单的 $print 函数,但我想添加一个简单的函数,当你输入一个特定的单词时,比如 $cat 它返回 cats are good 或者可能是一个图像/gif猫。我试着用这个来做。

@bot.command(NAME="hello")
    await ctx.channel.send("hi there")

基本上,我想在输入$hello 时输出hi there。但是当我尝试运行 python 文件时它会立即崩溃

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    代码几乎是错误的

    以下是修改后的代码:

    @bot.command()
    async def hello(ctx):
        await ctx.send("hi there")
    

    【讨论】:

      猜你喜欢
      • 2021-04-30
      • 2023-02-26
      • 2023-03-22
      • 2019-08-03
      • 2018-11-21
      • 2020-04-07
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      相关资源
      最近更新 更多