Removing .format() in favour of fstrings

pull/8/head
sgoudham 4 years ago
parent d3acc4bd39
commit dfa7c99c0b

@ -333,7 +333,7 @@ class Info(Cog):
# Set up Embed # Set up Embed
embed = Embed(title=f"Statistics For #{channel.name}", embed = Embed(title=f"Statistics For #{channel.name}",
description=f"{'Category: {}'.format(channel.category.name) if channel.category else 'N/A'}", description=f"{f'Category: {channel.category.name}' if channel.category else 'N/A'}",
timestamp=datetime.datetime.utcnow(), timestamp=datetime.datetime.utcnow(),
colour=self.bot.random_colour()) colour=self.bot.random_colour())
embed.set_thumbnail(url=ctx.guild.icon_url) embed.set_thumbnail(url=ctx.guild.icon_url)
@ -365,7 +365,7 @@ class Info(Cog):
colour=self.bot.admin_colour, colour=self.bot.admin_colour,
timestamp=datetime.datetime.utcnow()) timestamp=datetime.datetime.utcnow())
stats.set_thumbnail(url=self.bot.user.avatar_url) stats.set_thumbnail(url=self.bot.user.avatar_url)
stats.set_footer(text=f"Requested by {ctx.author}", icon_url='{}'.format(ctx.author.avatar_url)) stats.set_footer(text=f"Requested by {ctx.author}", icon_url=ctx.author.avatar_url)
# Grabbing technical statistics of the bot # Grabbing technical statistics of the bot
proc = Process() proc = Process()
@ -377,8 +377,7 @@ class Info(Cog):
uptime_hours, uptime_remainder = divmod(uptime.seconds, 3600) uptime_hours, uptime_remainder = divmod(uptime.seconds, 3600)
uptime_minutes, uptime_seconds = divmod(uptime_remainder, 60) uptime_minutes, uptime_seconds = divmod(uptime_remainder, 60)
frmt_uptime = '{:01} Hour(s), {:01} Minute(s), {:01} Second(s)'.format(int(uptime_hours), int(uptime_minutes), frmt_uptime = f'{int(uptime_hours):01} Hour(s), {int(uptime_minutes):01} Minute(s), {int(uptime_seconds):01} Second(s)'
int(uptime_seconds))
# Grabbing total number of channels across all guilds in which the bot is present in # Grabbing total number of channels across all guilds in which the bot is present in
channels = map(lambda m: len(m.channels), self.bot.guilds) channels = map(lambda m: len(m.channels), self.bot.guilds)
@ -400,13 +399,11 @@ class Info(Cog):
("❗ Current Prefix", ctx.prefix, True), ("❗ Current Prefix", ctx.prefix, True),
("Discord Stats", ("Discord Stats",
"Guilds: {}" f"Guilds: {len(self.bot.guilds)}"
"\nChannels: {}" f"\nChannels: {sum(list(channels))}"
"\nEmojis: {}" f"\nEmojis: {len(self.bot.emojis)}"
"\nCommands: {}" f"\nCommands: {len(self.bot.commands)}"
"\nUsers: {:,}".format(len(self.bot.guilds), sum(list(channels)), len(self.bot.emojis), f"\nUsers: {len(self.bot.users):,}", True),
len(self.bot.commands),
len(self.bot.users)), True),
("Line Count", lineCount(), True), ("Line Count", lineCount(), True),
("Uptime", frmt_uptime, False), ("Uptime", frmt_uptime, False),

Loading…
Cancel
Save