""" Commands for testing. """ import nextcord from nextcord.ext import application_checks, commands from classes.election_cycle import ElectionCycle from config import DakinyConfig from utils import get_current_cycle def is_me(): """ predicate that makes sure only I can run the test commands. """ def predicate(interaction: nextcord.Interaction): return interaction.user.id == 206602713511886849 return application_checks.check(predicate) class TestCog(commands.Cog, name="Test commands."): """ Class holds commands for testing. """ def __init__(self, bot) -> None: """ Default constructor for HelpCog class. Does nothing. """ self.bot = bot @nextcord.slash_command(guild_ids=[1000247361639030804]) async def test(self, interaction: nextcord.Interaction): """ Parent slash command for help. Never called. """ @test.subcommand() @is_me() async def election_start(self, interaction: nextcord.Interaction): """ idc Args: interaction (nextcord.Interaction): _description_ """ config: DakinyConfig = self.bot.config cycle = ElectionCycle( get_current_cycle(config), config, self.bot.get_guild(config.params.guild_id), ) await cycle.election_start_action() @test.subcommand() @is_me() async def voting_start(self, interaction: nextcord.Interaction): """ tests the voting start action Args: interaction (nextcord.Interaction): _description_ """ config: DakinyConfig = self.bot.config cycle = ElectionCycle( get_current_cycle(config), config, self.bot.get_guild(config.params.guild_id), ) await cycle.voting_start_action() @test.subcommand() @is_me() async def voting_end(self, interaction: nextcord.Interaction): """ tests the voting start action Args: interaction (nextcord.Interaction): _description_ """ config: DakinyConfig = self.bot.config cycle = ElectionCycle( get_current_cycle(config), config, self.bot.get_guild(config.params.guild_id), ) await cycle.voting_end_action() @test.subcommand() @is_me() async def highcouncil_vote(self, interaction: nextcord.Interaction): """ tests the voting start action Args: interaction (nextcord.Interaction): _description_ """ config: DakinyConfig = self.bot.config cycle = ElectionCycle( get_current_cycle(config), config, self.bot.get_guild(config.params.guild_id), ) await cycle.highcouncil_election_start_action() @test.subcommand() @is_me() async def election_reminder(self, interaction: nextcord.Interaction): config: DakinyConfig = self.bot.config cycle = ElectionCycle( get_current_cycle(config), config, self.bot.get_guild(config.params.guild_id), ) await cycle.election_reminder() @test.subcommand() @is_me() async def daily(self, interaction: nextcord.Interaction): config: DakinyConfig = self.bot.config cycle = ElectionCycle( get_current_cycle(config), config, self.bot.get_guild(config.params.guild_id), ) await cycle.check_date() @test.subcommand() @is_me() async def term_start(self, interaction: nextcord.Interaction): config: DakinyConfig = self.bot.config cycle = ElectionCycle( get_current_cycle(config), config, self.bot.get_guild(config.params.guild_id), ) await cycle.term_start_action()