Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # crime scene
- if message.content.strip().lower().startswith("$setup"):
- await message.channel.send("Please enter a floating-point number:")
- def check(m):
- return m.author == message.author and m.channel == message.channel
- try:
- reply = await client.wait_for("message", timeout=30.0, check=check)
- parts = reply.content.strip().split()
- if len(parts) != 2:
- await message.channel.send("You need to enter exactly two numbers.")
- return
- num1 = float(parts[0])
- num2 = float(parts[1])
- await message.channel.send(f"You entered: `{num1}` and `{num2}`")
- global current_temperature_2m
- current_temperature_2m = weather.fetch_weather(num1, num2)
- await message.channel.send(f"Current temp: {current_temperature_2m}°F")
- except ValueError:
- await message.channel.send("That wasn't a valid floating-point number.")
- except asyncio.TimeoutError:
- await message.channel.send("You took too long to respond.")
- if message.content.startswith('$weather'):
- await message.channel.send(f'Weather: {current_temperature_2m}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement