Skip to content

Commit

Permalink
Migrated clash of code cog to new extension format
Browse files Browse the repository at this point in the history
  • Loading branch information
FirePlank committed Nov 2, 2023
1 parent ac328ca commit 3e4df48
Show file tree
Hide file tree
Showing 7 changed files with 368 additions and 312 deletions.
311 changes: 0 additions & 311 deletions bot/cogs/clashofcode.py

This file was deleted.

10 changes: 10 additions & 0 deletions bot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ async def on_app_command_error(self, interaction: "InteractionType", error: app_
return

if isinstance(error, app_commands.CheckFailure):
if interaction.command.qualified_name.startswith("coc "):
if isinstance(error, app_commands.MissingAnyRole):
await interaction.response.send_message(
"You need to have the Clash Of Code role to use this command", ephemeral=True
)
else:
await interaction.response.send_message(
"You need to be in the Clash Of Code channel to use this command", ephemeral=True
)

log.info(f"{interaction.user} failed to use the command {interaction.command.qualified_name}")
return

Expand Down
9 changes: 9 additions & 0 deletions bot/extensions/clashofcode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from bot.core import DiscordBot

from .commands import ClashOfCode
from .events import ClashOfCodeEvents


async def setup(bot: DiscordBot) -> None:
await bot.add_cog(ClashOfCode(bot=bot))
await bot.add_cog(ClashOfCodeEvents(bot=bot))
Loading

0 comments on commit 3e4df48

Please sign in to comment.