Flushed out election start. Added a file to track what permissions the bot needs.

This commit is contained in:
2023-07-14 11:31:52 -04:00
parent 13325616fc
commit 797f8a46aa
3 changed files with 30 additions and 3 deletions
+15 -3
View File
@@ -45,7 +45,8 @@ class ElectionCycle:
Builds the messages to announce the election is starting. Builds the messages to announce the election is starting.
Returns: Returns:
list[str]: A list of message contents in the correct order. list[str]: A list of message contents in the correct order. Must be a string because the message is too
long.
""" """
with open("bot_messages/election_announcement.txt", mode="r", encoding="utf8") as file: with open("bot_messages/election_announcement.txt", mode="r", encoding="utf8") as file:
@@ -128,8 +129,19 @@ class ElectionCycle:
Performs required actions for when the election cycle starts. Performs required actions for when the election cycle starts.
""" """
print("election cycle has started") print("election cycle has started")
await self.message_me("election cycle has started") # create new channel for election
# TODO get message, input variables, split into multiple messages, send to correct channel. category: nextcord.CategoryChannel = self.bot.get_channel(self.config.params.active_category_id)
quarter_name: str = str(datetime.today().year) + "-" + self.elecion_cycle.name + "-election"
# TODO need to store this id in the sqlite database
election_channel = await category.create_text_channel(quarter_name)
# post message announcing election
# election start message is returned as an array of string because it is too long. send each string
# individually.
messages = self.build_election_announcement()
for message in messages:
await election_channel.send(message)
async def voting_start_action(self) -> None: async def voting_start_action(self) -> None:
""" """
+12
View File
@@ -41,3 +41,15 @@ class TestCog(commands.Cog, name="Test commands."):
# doesn't tell discord that the message was responded to. Is a test command so I don't really care atm. # doesn't tell discord that the message was responded to. Is a test command so I don't really care atm.
for m in message: for m in message:
await interaction.channel.send(content=m) await interaction.channel.send(content=m)
@test.subcommand()
async def election_start(self, interaction: nextcord.Interaction):
"""
idc
Args:
interaction (nextcord.Interaction): _description_
"""
cycle = ElectionCycle(0, self.bot)
await cycle.election_start_action()
+3
View File
@@ -0,0 +1,3 @@
Discord permissions required for bot to operate:
manage channels