aboutsummaryrefslogtreecommitdiff
path: root/examples/guessing_game.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-04 04:40:19 -0400
committerRapptz <[email protected]>2021-04-04 07:03:53 -0400
commit9d39b135f4f84239787b0901d06a4f370a82d4bb (patch)
tree8826845cfd47eafa5c9d2ef1fcbedd36382714f4 /examples/guessing_game.py
parentBump minimum Python version to 3.8 (diff)
downloaddiscord.py-9d39b135f4f84239787b0901d06a4f370a82d4bb.tar.xz
discord.py-9d39b135f4f84239787b0901d06a4f370a82d4bb.zip
Modernize code to use f-strings
This also removes the encoding on the top, since Python 3 does it by default. It also changes some methods to use `yield from`.
Diffstat (limited to 'examples/guessing_game.py')
-rw-r--r--examples/guessing_game.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/guessing_game.py b/examples/guessing_game.py
index a8f09c63..7620d7af 100644
--- a/examples/guessing_game.py
+++ b/examples/guessing_game.py
@@ -25,12 +25,12 @@ class MyClient(discord.Client):
try:
guess = await self.wait_for('message', check=is_correct, timeout=5.0)
except asyncio.TimeoutError:
- return await message.channel.send('Sorry, you took too long it was {}.'.format(answer))
+ return await message.channel.send(f'Sorry, you took too long it was {answer}.')
if int(guess.content) == answer:
await message.channel.send('You are right!')
else:
- await message.channel.send('Oops. It is actually {}.'.format(answer))
+ await message.channel.send(f'Oops. It is actually {answer}.')
client = MyClient()
client.run('token')