mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 01:16:21 +00:00
Use f-strings in more places that were missed.
This commit is contained in:
@ -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))
|
||||
|
@ -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')
|
||||
|
@ -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')
|
||||
|
Reference in New Issue
Block a user