Remove message builder, move builders to elecion_cycle.py.
build

This commit is contained in:
2023-07-02 11:04:51 -04:00
parent f0beb7821f
commit edc7722f76
4 changed files with 78 additions and 81 deletions
+6 -4
View File
@@ -5,7 +5,7 @@ Commands for testing.
import nextcord
from nextcord.ext import commands
from classes.message_builder import MessageBuilder
from classes.election_cycle import ElectionCycle
class TestCog(commands.Cog, name="Test commands."):
@@ -34,8 +34,10 @@ class TestCog(commands.Cog, name="Test commands."):
interaction (nextcord.Interaction): Interaction that invoked the command.
"""
msg_bulder = MessageBuilder(self.bot.config, 0)
message = msg_bulder.build_vote_start()
cycle = ElectionCycle(0, self.bot)
message = cycle.build_election_announcement()
# doesn't tell discord that the message was responded to. Is a test command so I don't really care atm.
await interaction.channel.send(content=message)
for m in message:
await interaction.channel.send(content=m)
+5 -3
View File
@@ -2,7 +2,7 @@
_summary_
"""
from datetime import datetime, time
from datetime import time
from nextcord.ext import commands, tasks
from pytz import timezone
@@ -17,7 +17,8 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
self.election = ElectionCycle(datetime(2023, 5, 25), datetime(2023, 5, 29), datetime(2023, 5, 30), self.bot)
# TODO need to figure out how to determine the current cycle
self.current_election = ElectionCycle(0, self.bot)
@commands.Cog.listener()
async def on_ready(self):
@@ -32,4 +33,5 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
async def do_thing(self):
""" """
print("loop")
await self.election.check_date()
await self.current_election.check_date()
# TODO need to figure out how to change the election cycle after current one is over