From 954f9252c1caa1bd9296d012e9acd9f685cfdd3a Mon Sep 17 00:00:00 2001 From: winston Date: Mon, 28 Nov 2022 04:51:51 +0100 Subject: [PATCH] feat: cog info --- autothreader/autothreader.py | 12 +++++++----- autothreader/info.json | 15 +++++++++++++++ info.json | 8 ++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 autothreader/info.json create mode 100644 info.json diff --git a/autothreader/autothreader.py b/autothreader/autothreader.py index 8249252..8c09a73 100644 --- a/autothreader/autothreader.py +++ b/autothreader/autothreader.py @@ -7,11 +7,13 @@ class AutoThreader(commands.Cog): def __init__(self, bot): self.bot = bot - self.config = Config.get_conf(self, identifier=8957967497) + self.config = Config.get_conf( + self, identifier=8957967497, force_registration=True + ) self.config.register_guild(autothread_channels=[]) @commands.Cog.listener() - async def on_message(self, msg: Message): + async def on_message(self, msg: Message) -> None: """Create a thread for each message in a channel.""" guild = msg.guild @@ -27,12 +29,12 @@ class AutoThreader(commands.Cog): @commands.guild_only() @commands.admin_or_permissions(manage_channels=True) @commands.command(name="autothread") - async def autothread(self, ctx: commands.Context, channel: TextChannel): + async def autothread(self, ctx: commands.Context, channel: TextChannel) -> None: """Setup a channel for autothreading.""" guild = ctx.guild if guild is None: - return await ctx.send("This command can only be used in a server.") + return watched_channels = await self.config.guild(guild).autothread_channels() @@ -45,7 +47,7 @@ class AutoThreader(commands.Cog): await self.config.guild(guild).autothread_channels.set(watched_channels) - async def create_thread(self, msg: Message): + async def create_thread(self, msg: Message) -> None: """Setup a channel for autothreading.""" channel = msg.channel thread_title = ( diff --git a/autothreader/info.json b/autothreader/info.json new file mode 100644 index 0000000..b9ffcad --- /dev/null +++ b/autothreader/info.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://raw.githubusercontent.com/Cog-Creators/Red-DiscordBot/V3/develop/schema/red_cog.schema.json", + "name": "autothreader", + "short": "Automatically create threads for new messages in a channel.", + "description": "Automatically create threads for new messages in a channel.", + "end_user_data_statement": "", + "author": ["nekowinston (winston#0001)"], + "required_cogs": {}, + "requirements": [], + "tags": [], + "min_bot_version": "3.5.0", + "hidden": false, + "disabled": false, + "type": "COG" +} diff --git a/info.json b/info.json new file mode 100644 index 0000000..712cecb --- /dev/null +++ b/info.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://raw.githubusercontent.com/Cog-Creators/Red-DiscordBot/V3/develop/schema/red_cog_repo.schema.json", + "name": "catppuccin-cogs", + "author": ["nekowinston (winston#0001)"], + "short": "Cogs for the Catppuccin Discord bot.", + "description": "Cogs for the Catppuccin Discord bot.", + "install_msg": "Thank you for installing my repo!" +}