Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f05751ce8 | ||
|
|
d32c27c291 | ||
|
|
391c36e7f2 | ||
|
|
846df89510 | ||
|
|
1eaa90e9cf | ||
|
|
9d2382bf1d |
@@ -1,8 +1,6 @@
|
||||
name: build_develop
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -2,6 +2,7 @@ name: build_develop
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -137,3 +137,5 @@ deleted_backups/
|
||||
highscores_data/
|
||||
TODO.txt
|
||||
sql_tester.py
|
||||
conf
|
||||
outputs
|
||||
|
||||
@@ -11,6 +11,7 @@ COPY cogs cogs/
|
||||
COPY dakiny_bot.py dakiny_bot.py
|
||||
COPY requirements.txt requirements.txt
|
||||
COPY config.py config.py
|
||||
COPY config.yml config.yml
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
|
||||
from dotenv.main import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
@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
|
||||
|
||||
# Discord config
|
||||
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN", "")
|
||||
|
||||
@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