aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-08 06:02:47 -0400
committerRapptz <[email protected]>2021-04-08 06:02:47 -0400
commit99fc9505107183faa59aad9e7753f293eba88836 (patch)
treef615ac678c5dc194fd2aa3a9a048a188b761b0d9 /examples
parentUpdate joined command in basic_bot to use f-strings (diff)
downloaddiscord.py-99fc9505107183faa59aad9e7753f293eba88836.tar.xz
discord.py-99fc9505107183faa59aad9e7753f293eba88836.zip
Use f-strings in more places that were missed.
Diffstat (limited to 'examples')
-rw-r--r--examples/basic_voice.py2
-rw-r--r--examples/deleted.py6
-rw-r--r--examples/edits.py6
3 files changed, 7 insertions, 7 deletions
diff --git a/examples/basic_voice.py b/examples/basic_voice.py
index 45387911..d7e82e6d 100644
--- a/examples/basic_voice.py
+++ b/examples/basic_voice.py
@@ -128,7 +128,7 @@ bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"),
@bot.event
async def on_ready():
- print('Logged in as {0} ({0.id})'.format(bot.user))
+ print(f'Logged in as {bot.user} ({bot.user.id})')
print('------')
bot.add_cog(Music(bot))
diff --git a/examples/deleted.py b/examples/deleted.py
index 6204c6fd..690460ce 100644
--- a/examples/deleted.py
+++ b/examples/deleted.py
@@ -3,7 +3,7 @@ import discord
class MyClient(discord.Client):
async def on_ready(self):
print('Connected!')
- print('Username: {0.name}\nID: {0.id}'.format(self.user))
+ print(f'Username: {self.user.name}\nID: {self.user.id}')
async def on_message(self, message):
if message.content.startswith('!deleteme'):
@@ -14,8 +14,8 @@ class MyClient(discord.Client):
await message.channel.send('Goodbye in 3 seconds...', delete_after=3.0)
async def on_message_delete(self, message):
- fmt = '{0.author} has deleted the message: {0.content}'
- await message.channel.send(fmt.format(message))
+ msg = f'{message.author} has deleted the message: {message.content}'
+ await message.channel.send(msg)
client = MyClient()
client.run('token')
diff --git a/examples/edits.py b/examples/edits.py
index 2c1db4d9..375a9bde 100644
--- a/examples/edits.py
+++ b/examples/edits.py
@@ -4,7 +4,7 @@ import asyncio
class MyClient(discord.Client):
async def on_ready(self):
print('Connected!')
- print('Username: {0.name}\nID: {0.id}'.format(self.user))
+ print(f'Username: {self.user.name}\nID: {self.user.id}')
async def on_message(self, message):
if message.content.startswith('!editme'):
@@ -13,8 +13,8 @@ class MyClient(discord.Client):
await msg.edit(content='40')
async def on_message_edit(self, before, after):
- fmt = '**{0.author}** edited their message:\n{0.content} -> {1.content}'
- await before.channel.send(fmt.format(before, after))
+ msg = f'**{before.author}** edited their message:\n{before.content} -> {after.content}'
+ await before.channel.send(msg)
client = MyClient()
client.run('token')