Archived
generated from imcompiling/discord-bot-template
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""Commands for testing."""
|
|
|
|
import nextcord
|
|
from nextcord.ext import application_checks, commands
|
|
|
|
from off_cooldown_bot.open_raid import OpenRaid
|
|
from off_cooldown_bot.utils import GUILDS
|
|
|
|
ME = 206602713511886849
|
|
|
|
|
|
def is_me(): # noqa: ANN201
|
|
"""Predicate that makes sure only I can run the test commands."""
|
|
|
|
def predicate(interaction: nextcord.Interaction) -> bool:
|
|
return interaction.user.id == ME
|
|
|
|
return application_checks.check(predicate)
|
|
|
|
|
|
class TestCog(commands.Cog, name="Test commands."):
|
|
"""Class holds commands for testing."""
|
|
|
|
def __init__(self, bot: commands.Bot) -> None:
|
|
self.bot: commands.Bot = bot
|
|
|
|
@nextcord.slash_command(guild_ids=GUILDS)
|
|
async def test(self, interaction: nextcord.Interaction) -> None:
|
|
"""Parent slash command for help. Never called."""
|
|
|
|
@test.subcommand()
|
|
@is_me()
|
|
async def election_start(self, interaction: nextcord.Interaction) -> None:
|
|
"""
|
|
Force starts election.
|
|
|
|
Args:
|
|
interaction (nextcord.Interaction): Interaction with the message.
|
|
|
|
"""
|
|
await interaction.response.send_message("Starting an open raid.", view=OpenRaid())
|