diff options
| author | 2020-02-24 16:48:57 -0800 | |
|---|---|---|
| committer | 2020-03-22 15:54:36 -0700 | |
| commit | 7de241bd6ca7d156e3014611596d6bcb969f9c96 (patch) | |
| tree | c9fcb7be55afca5ea0f9e5ca10499067ec011f83 | |
| parent | HelpChannels: implement the !dormant command (diff) | |
HelpChannels: add a function to make channels in-use
It handles moving the channel to the category and scheduling it to
be made dormant.
| -rw-r--r-- | bot/cogs/help_channels.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bot/cogs/help_channels.py b/bot/cogs/help_channels.py index b4121c7fd..806020873 100644 --- a/bot/cogs/help_channels.py +++ b/bot/cogs/help_channels.py @@ -249,6 +249,19 @@ class HelpChannels(Scheduler, commands.Cog): embed = discord.Embed(description=DORMANT_MSG) await channel.send(embed=embed) + async def move_to_in_use(self, channel: discord.TextChannel) -> None: + """Make a channel in-use and schedule it to be made dormant.""" + # Move the channel to the In Use category. + await channel.edit( + category=self.in_use_category, + sync_permissions=True, + topic=IN_USE_TOPIC, + ) + + # Schedule the channel to be moved to the Dormant category. + data = ChannelTimeout(channel, constants.HelpChannels.idle_minutes * 60) + self.schedule_task(self.bot.loop, channel.id, data) + @commands.Cog.listener() async def on_message(self, message: discord.Message) -> None: """Move an available channel to the In Use category and replace it with a dormant one.""" |