diff --git a/Robocop.py b/Robocop.py index 800e8d6..694c902 100755 --- a/Robocop.py +++ b/Robocop.py @@ -50,7 +50,9 @@ intents = discord.Intents.default() intents.typing = False intents.members = True -bot = commands.Bot(command_prefix=get_prefix, description=config.bot_description, intents=intents) +bot = commands.Bot( + command_prefix=get_prefix, description=config.bot_description, intents=intents +) bot.help_command = commands.DefaultHelpCommand(dm_help=True) bot.log = log diff --git a/cogs/lockdown.py b/cogs/lockdown.py index 98a054d..2c09180 100644 --- a/cogs/lockdown.py +++ b/cogs/lockdown.py @@ -58,7 +58,9 @@ class Lockdown(Cog): ) await ctx.send(public_msg) - safe_name = await commands.clean_content().convert(ctx, str(ctx.author)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(ctx.author) + ) msg = ( f"πŸ”’ **Lockdown**: {ctx.channel.mention} by {ctx.author.mention} " f"| {safe_name}" @@ -86,7 +88,9 @@ class Lockdown(Cog): for role in roles: await self.set_sendmessage(channel, role, True, ctx.author) - safe_name = await commands.clean_content().convert(ctx, str(ctx.author)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(ctx.author) + ) await ctx.send("πŸ”“ Channel unlocked.") msg = ( f"πŸ”“ **Unlock**: {ctx.channel.mention} by {ctx.author.mention} " diff --git a/cogs/meme.py b/cogs/meme.py index 5685cf1..07b0753 100644 --- a/cogs/meme.py +++ b/cogs/meme.py @@ -142,7 +142,9 @@ class Meme(Cog): f"I'm sorry {ctx.author.mention}, I'm afraid I can't do that." ) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) await ctx.send(f"{safe_name} is ΜΆnΝ’ow bΜ•&Μ‘.Μ· πŸ‘Μ‘") @commands.command(hidden=True) @@ -155,7 +157,16 @@ class Meme(Cog): """test""" await ctx.send("https://www.youtube.com/watch?v=VmarNEsjpDI") - @commands.command(hidden=True, aliases=["yotld", "yold", "yoltd", "yearoflinuxondesktop", "yearoflinuxonthedesktop"]) + @commands.command( + hidden=True, + aliases=[ + "yotld", + "yold", + "yoltd", + "yearoflinuxondesktop", + "yearoflinuxonthedesktop", + ], + ) async def yearoflinux(self, ctx): """Shows the year of Linux on the desktop""" await ctx.send( diff --git a/cogs/mod.py b/cogs/mod.py index 8753241..d509bab 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -52,7 +52,9 @@ class Mod(Cog): userlog(target.id, ctx.author, reason, "mutes", target.name) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) dm_message = f"You were muted!" if reason: @@ -95,7 +97,9 @@ class Mod(Cog): @commands.command() async def unmute(self, ctx, target: discord.Member): """Unmutes a user, staff only.""" - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) mute_role = ctx.guild.get_role(config.mute_role) await target.remove_roles(mute_role, reason=str(ctx.author)) @@ -133,7 +137,9 @@ class Mod(Cog): userlog(target.id, ctx.author, reason, "kicks", target.name) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) dm_message = f"You were kicked from {ctx.guild.name}." if reason: @@ -194,7 +200,9 @@ class Mod(Cog): userlog(target.id, ctx.author, reason, "bans", target.name) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) dm_message = f"You were banned from {ctx.guild.name}." if reason: @@ -251,7 +259,9 @@ class Mod(Cog): userlog(target, ctx.author, reason, "bans", target_user.name) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) await ctx.guild.ban( target_user, reason=f"{ctx.author}, reason: {reason}", delete_message_days=0 @@ -284,7 +294,9 @@ class Mod(Cog): """Unbans a user with their ID, doesn't message them, staff only.""" target_user = await self.bot.fetch_user(target) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) await ctx.guild.unban(target_user, reason=f"{ctx.author}, reason: {reason}") chan_message = ( @@ -325,7 +337,9 @@ class Mod(Cog): userlog(target.id, ctx.author, reason, "bans", target.name) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) await target.ban( reason=f"{ctx.author}, reason: {reason}", delete_message_days=0 @@ -436,7 +450,9 @@ class Mod(Cog): log_channel = self.bot.get_channel(config.modlog_channel) warn_count = userlog(target.id, ctx.author, reason, "warns", target.name) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) chan_msg = ( f"⚠️ **Warned**: {ctx.author.mention} warned " f"{target.mention} (warn #{warn_count}) " diff --git a/cogs/mod_timed.py b/cogs/mod_timed.py index 5ed9f58..6a4416f 100644 --- a/cogs/mod_timed.py +++ b/cogs/mod_timed.py @@ -44,7 +44,9 @@ class ModTimed(Cog): target.name, ) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) dm_message = f"You were banned from {ctx.guild.name}." if reason: @@ -110,7 +112,9 @@ class ModTimed(Cog): target.name, ) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) dm_message = f"You were muted!" if reason: diff --git a/cogs/mod_userlog.py b/cogs/mod_userlog.py index 88e03b0..e586d58 100644 --- a/cogs/mod_userlog.py +++ b/cogs/mod_userlog.py @@ -137,7 +137,9 @@ class ModUserlog(Cog): """Clears all events of given type for a user, staff only.""" log_channel = self.bot.get_channel(config.modlog_channel) msg = self.clear_event_from_id(str(target.id), event) - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) await ctx.send(msg) msg = ( f"πŸ—‘ **Cleared {event}**: {ctx.author.mention} cleared" @@ -173,7 +175,9 @@ class ModUserlog(Cog): # This is hell. if isinstance(del_event, discord.Embed): await ctx.send(f"{target.mention} has a {event_name} removed!") - safe_name = await commands.clean_content().convert(ctx, str(target)) + safe_name = await commands.clean_content(escape_markdown=True).convert( + ctx, str(target) + ) msg = ( f"πŸ—‘ **Deleted {event_name}**: " f"{ctx.author.mention} removed " @@ -219,8 +223,12 @@ class ModUserlog(Cog): str(user.id), str(user), event=event_types ) - user_name = await commands.clean_content().convert(ctx, user.name) - display_name = await commands.clean_content().convert(ctx, user.display_name) + user_name = await commands.clean_content(escape_markdown=True).convert( + ctx, user.name + ) + display_name = await commands.clean_content(escape_markdown=True).convert( + ctx, user.display_name + ) await ctx.send( f"user = {user_name}\n"