Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
不和谐Python机器人故障_Python_Math_Discord_Discord.py - Fatal编程技术网

不和谐Python机器人故障

不和谐Python机器人故障,python,math,discord,discord.py,Python,Math,Discord,Discord.py,我想让我的机器人接受输入!圆周率,然后它说“请输入圆的半径”,然后接受用户的输入,然后根据半径计算圆的周长 @client.event async def on_message(message): channel = message.channel if message.author == client.user: return msg = message.content def check(m): return m.content == 'hello'

我想让我的机器人接受输入!圆周率,然后它说“请输入圆的半径”,然后接受用户的输入,然后根据半径计算圆的周长

@client.event
async def on_message(message):
  channel = message.channel
  if message.author == client.user:
      return
  msg = message.content
  
  def check(m):
    return m.content == 'hello' and m.channel == channel
      
# checks for words in the message, if it finds words that correlate with the list it prints a random message from the other list
  if any(word in msg for word in key_words):
    await message.channel.send(random.choice(List_1))
# sends as photo of a rat from the rat list
  if msg.startswith("!ratrep"):
      while x == 1:
          await message.channel.send(random.choice(rat))

  if msg.startswith("!rat"):
      await message.channel.send(random.choice(rat))

# calculates the circumference of a cricle with the radius
  if msg.startswith("!pi"):
      await message.channel.send("please input the radius of the circle")
       
      msg = await client.wait_for("message", check=check)
      z = 2*3.14*int(float(message.content))
      await message.channel.send(z)

没有错误发生,在我输入数字后就没有消息了

我想你把
msg
message
混在了
z=2*3.14*int(float(message.content))
->
z=2*3.14*int(float(msg.content))