+2
-1
@@ -137,4 +137,5 @@ deleted_backups/
|
||||
highscores_data/
|
||||
TODO.txt
|
||||
sql_tester.py
|
||||
config.yml
|
||||
conf
|
||||
outputs
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@dataclass
|
||||
class Params:
|
||||
voting_emote_id: int
|
||||
annoucement_channel_id: int
|
||||
archive_channel_group_id: int
|
||||
clan_council_role_id: int
|
||||
clan_council_elect_role_id: int
|
||||
discord_token: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class ElectionCycle:
|
||||
election_start: datetime
|
||||
voting_start: datetime
|
||||
voting_end: datetime
|
||||
term_start: datetime
|
||||
term_end: datetime
|
||||
name: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class DakinyConfig:
|
||||
params: Params
|
||||
cycles: list[ElectionCycle]
|
||||
+11
-3
@@ -1,12 +1,19 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
import hydra
|
||||
import nextcord
|
||||
from hydra.core.config_store import ConfigStore
|
||||
from nextcord.ext import commands
|
||||
|
||||
import config
|
||||
from config import DakinyConfig
|
||||
|
||||
cs = ConfigStore.instance()
|
||||
cs.store(name="dakiny_config", node=DakinyConfig)
|
||||
|
||||
|
||||
def main():
|
||||
@hydra.main(config_path="conf", config_name="config")
|
||||
def main(cfg: DakinyConfig):
|
||||
# Allows privledged intents for monitoring members joining, roles editing, and role assignments
|
||||
# These need to be enabled in the developer portal as well
|
||||
intents = nextcord.Intents.default()
|
||||
@@ -33,8 +40,9 @@ def main():
|
||||
print(f"{bot.user.name} has connected to Discord!")
|
||||
|
||||
# Run Discord bot
|
||||
bot.run(config.DISCORD_TOKEN)
|
||||
bot.run(cfg.params.discord_token)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.argv.append("hydra.job.chdir=False")
|
||||
main()
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
nextcord==2.4.2
|
||||
python-dotenv==1.0.0
|
||||
pytz==2022.7.1
|
||||
pytz==2022.7.1
|
||||
hydra-core==1.3.2
|
||||
Reference in New Issue
Block a user