【问题标题】:Trying to get my discord bot to take a message as number input试图让我的不和谐机器人将消息作为数字输入
【发布时间】:2021-07-27 00:57:16
【问题描述】:
   await message.channel.send("please input the radius of the circle")
   alg(int(message.content()))
   await message.channel.send(alg) 

每次我在第一条消息后输入一个数字时都会收到以下错误。

File "main.py", line 138, in on_message
    alg(int(message.content()))
TypeError: 'str' object is not callable```

【问题讨论】:

    标签: input discord discord.py bots


    【解决方案1】:

    Message.content 是一个属性,而不是一个方法——意味着它不应该被调用(去掉括号)

    int(message.content)
    

    【讨论】:

      猜你喜欢
      • 2020-12-06
      • 1970-01-01
      • 2018-11-19
      • 2020-01-24
      • 2021-03-05
      • 1970-01-01
      • 2020-12-26
      • 2019-07-11
      • 2020-04-21
      相关资源
      最近更新 更多