diff --git a/classes/election_cycle.py b/classes/election_cycle.py index fa506cf..a60cdd4 100644 --- a/classes/election_cycle.py +++ b/classes/election_cycle.py @@ -23,7 +23,7 @@ from database_setup.sql_data_classes import ( from utils import ( build_highcouncil_votes_str, build_votes_str, - edit_clan_council_message, + edit_clan_council_info, get_cl_election_name, get_datetime, get_dm_election_name, @@ -438,7 +438,7 @@ class ElectionCycle: ) await election_thread.edit(archived=True, locked=True) - await edit_clan_council_message(self.guild, self.config) + await edit_clan_council_info(self.guild, self.config) def get_election_info(self) -> ElectionInformation: """ diff --git a/cogs/commands/__init__.py b/cogs/commands/__init__.py index 725f143..df6a0c2 100644 --- a/cogs/commands/__init__.py +++ b/cogs/commands/__init__.py @@ -21,7 +21,7 @@ def setup(bot: commands.Bot): """ bot.add_cog(RecordCog(bot)) - bot.add_cog(RefreshCog()) + bot.add_cog(RefreshCog(bot)) bot.add_cog(RemoveCog()) bot.add_cog(RequestCog(bot)) bot.add_cog(TestCog(bot)) diff --git a/cogs/commands/refresh.py b/cogs/commands/refresh.py index e04b067..cadc1a5 100644 --- a/cogs/commands/refresh.py +++ b/cogs/commands/refresh.py @@ -5,7 +5,7 @@ Contained commands and views for refresh commands. import nextcord from nextcord.ext import commands -from utils import update_clan_messages +from utils import edit_clan_council_info, update_clan_messages class RefreshCog(commands.Cog, name="Refresh Commands"): @@ -13,6 +13,13 @@ class RefreshCog(commands.Cog, name="Refresh Commands"): Class holds refresh commands. """ + def __init__(self, bot) -> None: + """ + Default constructor for RefreshCog class. Does nothing. + """ + super().__init__() + self.bot: commands.Bot = bot + @nextcord.slash_command( default_member_permissions=nextcord.Permissions(administrator=True) ) @@ -32,3 +39,16 @@ class RefreshCog(commands.Cog, name="Refresh Commands"): await interaction.response.defer(ephemeral=True) await update_clan_messages(interaction.guild) await interaction.followup.send("Messages have been refreshed.", ephemeral=True) + + @refresh.subcommand(description="Updates the current council info message.") + async def council_info(self, interaction: nextcord.Interaction): + """ + Calls edit_clan_council_info(). + + Args: + interaction (nextcord.Interaction): Interaction with the command. + """ + await edit_clan_council_info(interaction.guild, self.bot.config) + await interaction.response.send_message( + "Clan Council Info message updated.", ephemeral=True + ) diff --git a/utils.py b/utils.py index e09a6c5..0dbbfdb 100644 --- a/utils.py +++ b/utils.py @@ -529,7 +529,7 @@ async def edit_clan_message( session.commit() -async def edit_clan_council_message(guild: nextcord.Guild, config: DakinyConfig): +async def edit_clan_council_info(guild: nextcord.Guild, config: DakinyConfig): """ Gets the winners of the elections and updates the perminant message that states the current council.