diff --git a/bot.py b/bot.py index 4de7329..b08e97c 100644 --- a/bot.py +++ b/bot.py @@ -61,6 +61,8 @@ async def setup_hook(self): async def on_ready(self): log.info('Logged in as %s (ID: %d)', self.user, self.user.id) + synced = await self.tree.sync() + log.info(f"Slash CMDs Synced: {str(len(synced))} Commands") async def on_resumed(self): log.info('Resumed') diff --git a/cogs/map_testing/__init__.py b/cogs/map_testing/__init__.py index a2ce74f..4d12434 100644 --- a/cogs/map_testing/__init__.py +++ b/cogs/map_testing/__init__.py @@ -7,6 +7,7 @@ import discord from discord.ext import commands, tasks +from discord import app_commands from cogs.map_testing.log import TestLog from cogs.map_testing.map_channel import MapChannel, MapState @@ -646,6 +647,25 @@ async def archive_imm(self, ctx: commands.Context): await ctx.message.add_reaction(':oop:395753983379243028') log.error('Failed archiving channel #%s', map_channel) + @app_commands.command(name='promote', description="Creates a private thread to discuss the promotion") + @app_commands.describe(trial_tester='@mention the trial tester to promote') + async def create_thread(self, interaction: discord.Interaction, trial_tester: discord.Member): + await interaction.response.defer(ephemeral=True, thinking=True) # noqa + + channel = interaction.channel + + thread = await channel.create_thread(name=f'Promote {trial_tester.global_name}', message=None, invitable=False) + await thread.send( + f'<@&930665860408946708> \n' + f'{interaction.user.mention} suggests to promote {trial_tester.global_name} to Tester. Opinions?' + ) + + await interaction.followup.send( # noqa + f"<@{interaction.user.id}> your thread has been created: {thread.jump_url}", ephemeral=True) + log.info(f'{interaction.user} (ID: {interaction.user.id}) created a thread in {interaction.channel.name}') + + if interaction.response.is_done(): # noqa + return async def setup(bot: commands.Bot): await bot.add_cog(MapTesting(bot))