diff options
-rw-r--r-- | bot/cogs/antispam.py | 2 | ||||
-rw-r--r-- | bot/cogs/defcon.py | 5 | ||||
-rw-r--r-- | bot/cogs/doc.py | 3 | ||||
-rw-r--r-- | bot/cogs/filtering.py | 2 | ||||
-rw-r--r-- | bot/cogs/modlog.py | 30 | ||||
-rw-r--r-- | bot/cogs/off_topic_names.py | 22 | ||||
-rw-r--r-- | bot/cogs/snekbox.py | 12 | ||||
-rw-r--r-- | bot/cogs/superstarify/__init__.py | 4 |
8 files changed, 33 insertions, 47 deletions
diff --git a/bot/cogs/antispam.py b/bot/cogs/antispam.py index 8dfa0ad05..dac00c1a3 100644 --- a/bot/cogs/antispam.py +++ b/bot/cogs/antispam.py @@ -59,7 +59,7 @@ class DeletionContext: async def upload_messages(self, actor_id: int, modlog: ModLog) -> None: """Method that takes care of uploading the queue and posting modlog alert.""" - triggered_by_users = ", ".join(f"{m.display_name}#{m.discriminator} (`{m.id}`)" for m in self.members.values()) + triggered_by_users = ", ".join(f"{m} (`{m.id}`)" for m in self.members.values()) mod_alert_message = ( f"**Triggered by:** {triggered_by_users}\n" diff --git a/bot/cogs/defcon.py b/bot/cogs/defcon.py index 048d8a683..f3740b276 100644 --- a/bot/cogs/defcon.py +++ b/bot/cogs/defcon.py @@ -88,8 +88,7 @@ class Defcon(Cog): await member.kick(reason="DEFCON active, user is too new") message = ( - f"{member.name}#{member.discriminator} (`{member.id}`) " - f"was denied entry because their account is too new." + f"{member} (`{member.id}`) was denied entry because their account is too new." ) if not message_sent: @@ -252,7 +251,7 @@ class Defcon(Cog): `change` string may be one of the following: ('enabled', 'disabled', 'updated') """ - log_msg = f"**Staffer:** {actor.name}#{actor.discriminator} (`{actor.id}`)\n" + log_msg = f"**Staffer:** {actor} (`{actor.id}`)\n" if change.lower() == "enabled": icon = Icons.defcon_enabled diff --git a/bot/cogs/doc.py b/bot/cogs/doc.py index c9e6b3b91..d5a14dbc8 100644 --- a/bot/cogs/doc.py +++ b/bot/cogs/doc.py @@ -331,8 +331,7 @@ class Doc(commands.Cog): await self.bot.api_client.post('bot/documentation-links', json=body) log.info( - f"User @{ctx.author.name}#{ctx.author.discriminator} ({ctx.author.id}) " - "added a new documentation package:\n" + f"User @{ctx.author} ({ctx.author.id}) added a new documentation package:\n" f"Package name: {package_name}\n" f"Base url: {base_url}\n" f"Inventory URL: {inventory_url}" diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index bd8c6ed67..095ddc185 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -186,7 +186,7 @@ class Filtering(Cog): message = ( f"The {filter_name} {_filter['type']} was triggered " - f"by **{msg.author.name}#{msg.author.discriminator}** " + f"by **{msg.author}** " f"(`{msg.author.id}`) {channel_str} with [the " f"following message]({msg.jump_url}):\n\n" f"{msg.content}" diff --git a/bot/cogs/modlog.py b/bot/cogs/modlog.py index 68424d268..79787dc95 100644 --- a/bot/cogs/modlog.py +++ b/bot/cogs/modlog.py @@ -367,7 +367,7 @@ class ModLog(Cog, name="ModLog"): await self.send_log_message( Icons.user_ban, Colour(Colours.soft_red), - "User banned", f"{member.name}#{member.discriminator} (`{member.id}`)", + "User banned", f"{member} (`{member.id}`)", thumbnail=member.avatar_url_as(static_format="png"), channel_id=Channels.modlog ) @@ -378,7 +378,7 @@ class ModLog(Cog, name="ModLog"): if member.guild.id != GuildConstant.id: return - message = f"{member.name}#{member.discriminator} (`{member.id}`)" + message = f"{member} (`{member.id}`)" now = datetime.utcnow() difference = abs(relativedelta(now, member.created_at)) @@ -406,7 +406,7 @@ class ModLog(Cog, name="ModLog"): await self.send_log_message( Icons.sign_out, Colour(Colours.soft_red), - "User left", f"{member.name}#{member.discriminator} (`{member.id}`)", + "User left", f"{member} (`{member.id}`)", thumbnail=member.avatar_url_as(static_format="png"), channel_id=Channels.userlog ) @@ -423,7 +423,7 @@ class ModLog(Cog, name="ModLog"): await self.send_log_message( Icons.user_unban, Colour.blurple(), - "User unbanned", f"{member.name}#{member.discriminator} (`{member.id}`)", + "User unbanned", f"{member} (`{member.id}`)", thumbnail=member.avatar_url_as(static_format="png"), channel_id=Channels.modlog ) @@ -510,7 +510,7 @@ class ModLog(Cog, name="ModLog"): for item in sorted(changes): message += f"{Emojis.bullet} {item}\n" - message = f"**{after.name}#{after.discriminator}** (`{after.id}`)\n{message}" + message = f"**{after}** (`{after.id}`)\n{message}" await self.send_log_message( Icons.user_update, Colour.blurple(), @@ -539,14 +539,14 @@ class ModLog(Cog, name="ModLog"): if channel.category: response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** {channel.category}/#{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{message.id}`\n" "\n" ) else: response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** #{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{message.id}`\n" "\n" @@ -637,7 +637,7 @@ class ModLog(Cog, name="ModLog"): if channel.category: before_response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** {channel.category}/#{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{before.id}`\n" "\n" @@ -645,7 +645,7 @@ class ModLog(Cog, name="ModLog"): ) after_response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** {channel.category}/#{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{before.id}`\n" "\n" @@ -653,7 +653,7 @@ class ModLog(Cog, name="ModLog"): ) else: before_response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** #{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{before.id}`\n" "\n" @@ -661,7 +661,7 @@ class ModLog(Cog, name="ModLog"): ) after_response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** #{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{before.id}`\n" "\n" @@ -720,7 +720,7 @@ class ModLog(Cog, name="ModLog"): if channel.category: before_response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** {channel.category}/#{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{message.id}`\n" "\n" @@ -728,7 +728,7 @@ class ModLog(Cog, name="ModLog"): ) after_response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** {channel.category}/#{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{message.id}`\n" "\n" @@ -736,7 +736,7 @@ class ModLog(Cog, name="ModLog"): ) else: before_response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** #{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{message.id}`\n" "\n" @@ -744,7 +744,7 @@ class ModLog(Cog, name="ModLog"): ) after_response = ( - f"**Author:** {author.name}#{author.discriminator} (`{author.id}`)\n" + f"**Author:** {author} (`{author.id}`)\n" f"**Channel:** #{channel.name} (`{channel.id}`)\n" f"**Message ID:** `{message.id}`\n" "\n" diff --git a/bot/cogs/off_topic_names.py b/bot/cogs/off_topic_names.py index 8cde22240..bbd592529 100644 --- a/bot/cogs/off_topic_names.py +++ b/bot/cogs/off_topic_names.py @@ -110,12 +110,11 @@ class OffTopicNames(Cog): if close_match: match = close_match[0] log.info( - f"{ctx.author.name}#{ctx.author.discriminator}" - f" tried to add channel name '{name}' but it was too similar to '{match}'" + f"{ctx.author} tried to add channel name '{name}' but it was too similar to '{match}'" ) await ctx.send( f":x: The channel name `{name}` is too similar to `{match}`, and thus was not added. " - f"Use `!otn forceadd` to override this check." + "Use `!otn forceadd` to override this check." ) else: await self._add_name(ctx, name) @@ -130,11 +129,9 @@ class OffTopicNames(Cog): async def _add_name(self, ctx: Context, name: str) -> None: """Adds an off-topic channel name to the site storage.""" - await self.bot.api_client.post(f'bot/off-topic-channel-names', params={'name': name}) - log.info( - f"{ctx.author.name}#{ctx.author.discriminator}" - f" added the off-topic channel name '{name}'" - ) + await self.bot.api_client.post('bot/off-topic-channel-names', params={'name': name}) + + log.info(f"{ctx.author} added the off-topic channel name '{name}'") await ctx.send(f":ok_hand: Added `{name}` to the names list.") @otname_group.command(name='delete', aliases=('remove', 'rm', 'del', 'd')) @@ -143,12 +140,9 @@ class OffTopicNames(Cog): """Removes a off-topic name from the rotation.""" # Chain multiple words to a single one name = "-".join(names) - await self.bot.api_client.delete(f'bot/off-topic-channel-names/{name}') - log.info( - f"{ctx.author.name}#{ctx.author.discriminator}" - f" deleted the off-topic channel name '{name}" - ) + + log.info(f"{ctx.author} deleted the off-topic channel name '{name}'") await ctx.send(f":ok_hand: Removed `{name}` from the names list.") @otname_group.command(name='list', aliases=('l',)) @@ -180,7 +174,7 @@ class OffTopicNames(Cog): close_matches = difflib.get_close_matches(query, result, n=10, cutoff=0.70) lines = sorted(f"• {name}" for name in in_matches.union(close_matches)) embed = Embed( - title=f"Query results", + title="Query results", colour=Colour.blue() ) diff --git a/bot/cogs/snekbox.py b/bot/cogs/snekbox.py index 81185cf3e..c0390cb1e 100644 --- a/bot/cogs/snekbox.py +++ b/bot/cogs/snekbox.py @@ -178,7 +178,7 @@ class Snekbox(Cog): if ctx.author.id in self.jobs: await ctx.send( f"{ctx.author.mention} You've already got a job running - " - f"please wait for it to finish!" + "please wait for it to finish!" ) return @@ -186,10 +186,7 @@ class Snekbox(Cog): await ctx.invoke(self.bot.get_command("help"), "eval") return - log.info( - f"Received code from {ctx.author.name}#{ctx.author.discriminator} " - f"for evaluation:\n{code}" - ) + log.info(f"Received code from {ctx.author} for evaluation:\n{code}") self.jobs[ctx.author.id] = datetime.datetime.now() code = self.prepare_input(code) @@ -213,10 +210,7 @@ class Snekbox(Cog): wait_for_deletion(response, user_ids=(ctx.author.id,), client=ctx.bot) ) - log.info( - f"{ctx.author.name}#{ctx.author.discriminator}'s job had a return code of " - f"{results['returncode']}" - ) + log.info(f"{ctx.author}'s job had a return code of {results['returncode']}") finally: del self.jobs[ctx.author.id] diff --git a/bot/cogs/superstarify/__init__.py b/bot/cogs/superstarify/__init__.py index 87021eded..b36f70404 100644 --- a/bot/cogs/superstarify/__init__.py +++ b/bot/cogs/superstarify/__init__.py @@ -132,7 +132,7 @@ class Superstarify(Cog): # Log to the mod_log channel log.trace("Logging to the #mod-log channel. This could fail because of channel permissions.") mod_log_message = ( - f"**{member.name}#{member.discriminator}** (`{member.id}`)\n\n" + f"**{member}** (`{member.id}`)\n\n" f"Superstarified member potentially tried to escape the prison.\n" f"Restored enforced nickname: `{forced_nick}`\n" f"Superstardom ends: **{end_timestamp_human}**" @@ -192,7 +192,7 @@ class Superstarify(Cog): # Log to the mod_log channel log.trace("Logging to the #mod-log channel. This could fail because of channel permissions.") mod_log_message = ( - f"**{member.name}#{member.discriminator}** (`{member.id}`)\n\n" + f"**{member}** (`{member.id}`)\n\n" f"Superstarified by **{ctx.author.name}**\n" f"Old nickname: `{member.display_name}`\n" f"New nickname: `{forced_nick}`\n" |