Compare commits
5
Commits
v1.5.0
..
bc56830396
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc56830396 | ||
|
|
1d14f8171d | ||
|
|
2efd380a7e | ||
|
|
475170025a | ||
|
|
f4f3bfe103 |
@@ -105,7 +105,6 @@ venv/
|
|||||||
ENV/
|
ENV/
|
||||||
env.bak/
|
env.bak/
|
||||||
venv.bak/
|
venv.bak/
|
||||||
poetry.lock
|
|
||||||
|
|
||||||
# Spyder project settings
|
# Spyder project settings
|
||||||
.spyderproject
|
.spyderproject
|
||||||
|
|||||||
+7
-4
@@ -1,19 +1,22 @@
|
|||||||
FROM python:3.11.9-slim
|
FROM python:3.10.6-slim
|
||||||
|
|
||||||
# install dependencies
|
# install dependencies
|
||||||
RUN apt-get update && apt-get -y upgrade && apt-get -y install git sqlite3
|
RUN apt-get update && apt-get -y upgrade && apt-get -y install git
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip
|
||||||
|
|
||||||
WORKDIR /home
|
WORKDIR /home
|
||||||
|
|
||||||
|
COPY requirements.txt requirements.txt
|
||||||
|
|
||||||
COPY config.py config.py
|
COPY config.py config.py
|
||||||
COPY main.py main.py
|
COPY main.py main.py
|
||||||
COPY utils.py utils.py
|
COPY utils.py utils.py
|
||||||
COPY pyproject.toml pyproject.toml
|
|
||||||
|
|
||||||
COPY classes classes/
|
COPY classes classes/
|
||||||
COPY cogs cogs/
|
COPY cogs cogs/
|
||||||
COPY database_setup database_setup/
|
COPY database_setup database_setup/
|
||||||
|
|
||||||
RUN pip install --upgrade pip && pip install poetry && poetry export -f requirements.txt --output requirements.txt && pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
CMD ["python3", "-u", "./main.py"]
|
CMD ["python3", "-u", "./main.py"]
|
||||||
@@ -22,6 +22,7 @@ from database_setup.sql_data_classes import (
|
|||||||
)
|
)
|
||||||
from utils import (
|
from utils import (
|
||||||
TEMPLATES_DIR,
|
TEMPLATES_DIR,
|
||||||
|
VoteType,
|
||||||
build_highcouncil_votes_str,
|
build_highcouncil_votes_str,
|
||||||
build_votes_str,
|
build_votes_str,
|
||||||
edit_clan_council_info,
|
edit_clan_council_info,
|
||||||
@@ -294,7 +295,11 @@ class ElectionCycle:
|
|||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
# add the highcouncil role to everyone with 3 or more votes. set elected to true in database
|
# add the highcouncil role to everyone with 3 or more votes. set elected to true in database
|
||||||
stmt = select(Votes.VotedForId).where(Votes.ElectionCycle == election_name)
|
stmt = (
|
||||||
|
select(Votes.VotedForId)
|
||||||
|
.where(Votes.ElectionCycle == election_name)
|
||||||
|
.where(Votes.Type == VoteType.COUNCIL.value)
|
||||||
|
)
|
||||||
vote_count = collections.Counter(session.scalars(stmt))
|
vote_count = collections.Counter(session.scalars(stmt))
|
||||||
|
|
||||||
for user_id, votes in vote_count.items():
|
for user_id, votes in vote_count.items():
|
||||||
|
|||||||
@@ -25,8 +25,9 @@ CREATE TABLE Votes(
|
|||||||
ElectionCycle varchar(30) not null,
|
ElectionCycle varchar(30) not null,
|
||||||
VoterId bigint unsigned not null,
|
VoterId bigint unsigned not null,
|
||||||
VotedForId bigint unsigned,
|
VotedForId bigint unsigned,
|
||||||
|
Type int unsigned not null,
|
||||||
FOREIGN KEY (ElectionCycle) REFERENCES ElectionInformation(ElectionCycle),
|
FOREIGN KEY (ElectionCycle) REFERENCES ElectionInformation(ElectionCycle),
|
||||||
PRIMARY KEY (ElectionCycle, VoterId)
|
PRIMARY KEY (ElectionCycle, VoterId, Type)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE UserBirthday (
|
CREATE TABLE UserBirthday (
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
[tool.poetry]
|
|
||||||
name = "dakiny-bot"
|
|
||||||
version = "0.1.0"
|
|
||||||
description = "Dakiny's Discord Bot."
|
|
||||||
authors = ["imcompiling <[email protected]>"]
|
|
||||||
readme = "README.md"
|
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
|
||||||
python = "^3.11"
|
|
||||||
gitpython = "3.1.43"
|
|
||||||
fastapi = "0.111.0"
|
|
||||||
hydra-core = "1.3.2"
|
|
||||||
nextcord = "2.4.2"
|
|
||||||
pandas = "1.5.2"
|
|
||||||
python-dotenv = "1.0.0"
|
|
||||||
pytz = "2022.7.1"
|
|
||||||
sqlalchemy = "1.4.46"
|
|
||||||
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["poetry-core"]
|
|
||||||
build-backend = "poetry.core.masonry.api"
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
GitPython==3.1.43
|
||||||
|
fastapi==0.111.0
|
||||||
|
hydra-core==1.3.2
|
||||||
|
nextcord==2.4.2
|
||||||
|
pandas==1.5.2
|
||||||
|
python-dotenv==1.0.0
|
||||||
|
pytz==2022.7.1
|
||||||
|
sqlalchemy==1.4.46
|
||||||
@@ -4,6 +4,7 @@ File contains util functions.
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from enum import Enum
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
import nextcord
|
import nextcord
|
||||||
@@ -24,6 +25,8 @@ REPO_DIR = "./dakiny-messages"
|
|||||||
MESSAGES_DIR = f"{REPO_DIR}/messages"
|
MESSAGES_DIR = f"{REPO_DIR}/messages"
|
||||||
TEMPLATES_DIR = f"{REPO_DIR}/message_templates"
|
TEMPLATES_DIR = f"{REPO_DIR}/message_templates"
|
||||||
|
|
||||||
|
VoteType = Enum("VoteType", ["COUNCIL", "DISCORDMANAGER", "CLANLEADER"])
|
||||||
|
|
||||||
|
|
||||||
def get_datetime(day: str) -> datetime:
|
def get_datetime(day: str) -> datetime:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user