我希望我的机器人接受输入!pi,然后它说“请输入圆的半径”然后接受用户的输入,然后它应该从半径计算圆的周长
@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)
没有错误发生,输入号码后没有消息