From 70e612882d1093b133d13302dccfba6aa2778474 Mon Sep 17 00:00:00 2001 From: Parker Date: Thu, 31 Oct 2024 00:26:00 -0500 Subject: `black --line-length 79` --- code/cogs/owner/sync.py | 50 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 11 deletions(-) (limited to 'code/cogs/owner/sync.py') diff --git a/code/cogs/owner/sync.py b/code/cogs/owner/sync.py index 05259cf..d6647b5 100644 --- a/code/cogs/owner/sync.py +++ b/code/cogs/owner/sync.py @@ -10,17 +10,27 @@ class TreeSync(commands.Cog): @commands.dm_only() @commands.is_owner() async def tree(self, ctx): - await ctx.author.send(f"This is a group command. Use either `{self.bot.command_prefix}tree sync` or `{self.bot.command_prefix}tree clear` followed by an optional guild ID.") + await ctx.author.send( + "This is a group command. Use either" + f" `{self.bot.command_prefix}tree sync` or" + f" `{self.bot.command_prefix}tree clear` followed by an optional" + " guild ID." + ) @commands.dm_only() @commands.is_owner() @tree.command() - async def sync(self, ctx: commands.Context, *, guild: discord.Object = None): + async def sync( + self, ctx: commands.Context, *, guild: discord.Object = None + ): """Sync the command tree to a guild or globally.""" if guild: self.bot.tree.copy_global_to(guild=guild) await self.bot.tree.sync(guild=guild) - return await ctx.author.send(f"Synced the command tree to `{self.bot.get_guild(guild.id).name}`") + return await ctx.author.send( + "Synced the command tree to" + f" `{self.bot.get_guild(guild.id).name}`" + ) else: await self.bot.tree.sync() return await ctx.author.send("Synced the command tree globally.") @@ -28,11 +38,17 @@ class TreeSync(commands.Cog): @sync.error async def tree_sync_error(self, ctx, error): if isinstance(error, commands.ObjectNotFound): - return await ctx.author.send("The guild you provided does not exist.") + return await ctx.author.send( + "The guild you provided does not exist." + ) if isinstance(error, commands.CommandInvokeError): - return await ctx.author.send("Guild ID provided is not a guild that the bot is in.") + return await ctx.author.send( + "Guild ID provided is not a guild that the bot is in." + ) else: - return await ctx.author.send("An unknown error occurred. Perhaps you've been rate limited.") + return await ctx.author.send( + "An unknown error occurred. Perhaps you've been rate limited." + ) @commands.dm_only() @commands.is_owner() @@ -41,18 +57,30 @@ class TreeSync(commands.Cog): """Clear the command tree from a guild.""" self.bot.tree.clear_commands(guild=guild) await self.bot.tree.sync(guild=guild) - return await ctx.author.send(f"Cleared the command tree from `{self.bot.get_guild(guild.id).name}`") + return await ctx.author.send( + "Cleared the command tree from" + f" `{self.bot.get_guild(guild.id).name}`" + ) @clear.error async def tree_sync_error(self, ctx, error): if isinstance(error, commands.MissingRequiredArgument): - return await ctx.author.send("You need to provide a guild ID to clear the command tree from.") + return await ctx.author.send( + "You need to provide a guild ID to clear the command tree" + " from." + ) if isinstance(error, commands.ObjectNotFound): - return await ctx.author.send("The guild you provided does not exist.") + return await ctx.author.send( + "The guild you provided does not exist." + ) if isinstance(error, commands.CommandInvokeError): - return await ctx.author.send("Guild ID provided is not a guild that the bot is in.") + return await ctx.author.send( + "Guild ID provided is not a guild that the bot is in." + ) else: - return await ctx.author.send("An unknown error occurred. Perhaps you've been rate limited.") + return await ctx.author.send( + "An unknown error occurred. Perhaps you've been rate limited." + ) async def setup(bot): -- cgit v1.2.3-70-g09d2