Update imports for new file structure.
This commit is contained in:
Vendored
+3
-2
@@ -6,6 +6,7 @@
|
|||||||
"CLANLEADER",
|
"CLANLEADER",
|
||||||
"Dakiny",
|
"Dakiny",
|
||||||
"DISCORDMANAGER",
|
"DISCORDMANAGER",
|
||||||
"highcouncil"
|
"highcouncil",
|
||||||
|
"nextcord"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
"""Empty init file for dakiny_bot module."""
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
"""Starts the app for dakiny_bot."""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from .app import run
|
||||||
|
|
||||||
|
nextcord_logger = logging.getLogger("nextcord")
|
||||||
|
nextcord_logger.setLevel(logging.DEBUG)
|
||||||
|
nextcord_handler = logging.FileHandler(filename="nextcord.log", encoding="utf-8", mode="w")
|
||||||
|
nextcord_handler.setFormatter(logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s"))
|
||||||
|
nextcord_logger.addHandler(nextcord_handler)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
run()
|
||||||
@@ -6,12 +6,13 @@ import os
|
|||||||
import nextcord
|
import nextcord
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from classes.nominate_highcouncil_views import NominateHighCouncilView
|
from dakiny_bot.classes.nominate_highcouncil_views import NominateHighCouncilView
|
||||||
from classes.nominate_views import NominateView
|
from dakiny_bot.classes.nominate_views import NominateView
|
||||||
from classes.voting_highcouncil_views import VoteHighcouncilView
|
from dakiny_bot.classes.voting_highcouncil_views import VoteHighcouncilView
|
||||||
from classes.voting_views import VoteView
|
from dakiny_bot.classes.voting_views import VoteView
|
||||||
from DakinySettings import settings
|
from dakiny_bot.database import create_database
|
||||||
from database_setup import create_database
|
|
||||||
|
from .DakinySettings import settings
|
||||||
|
|
||||||
birthday_list: list[int] = []
|
birthday_list: list[int] = []
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@ handler.setFormatter(logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(me
|
|||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def run() -> None:
|
||||||
"""Builds and runs bot."""
|
"""Builds and runs bot."""
|
||||||
# Allows privileged intents for monitoring members joining, roles editing, and role assignments
|
# Allows privileged intents for monitoring members joining, roles editing, and role assignments
|
||||||
# These need to be enabled in the developer portal as well
|
# These need to be enabled in the developer portal as well
|
||||||
@@ -53,7 +54,3 @@ def main() -> None:
|
|||||||
|
|
||||||
# Run Discord bot
|
# Run Discord bot
|
||||||
bot.run(settings.params.discord_token)
|
bot.run(settings.params.discord_token)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -5,20 +5,21 @@ from datetime import UTC, datetime, timedelta
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import nextcord
|
import nextcord
|
||||||
from classes.nominate_highcouncil_views import NominateHighCouncilView
|
from sqlalchemy import select, true, update
|
||||||
from classes.nominate_views import NominateView
|
from sqlalchemy.orm import Session
|
||||||
from classes.voting_highcouncil_views import VoteHighcouncilView
|
|
||||||
from classes.voting_views import VoteView
|
from dakiny_bot.classes.nominate_highcouncil_views import NominateHighCouncilView
|
||||||
from DakinySettings import settings
|
from dakiny_bot.classes.nominate_views import NominateView
|
||||||
from database_setup.sql_data_classes import (
|
from dakiny_bot.classes.voting_highcouncil_views import VoteHighcouncilView
|
||||||
|
from dakiny_bot.classes.voting_views import VoteView
|
||||||
|
from dakiny_bot.DakinySettings import settings
|
||||||
|
from dakiny_bot.database.sql_data_classes import (
|
||||||
CouncilMembers,
|
CouncilMembers,
|
||||||
ElectionInformation,
|
ElectionInformation,
|
||||||
Votes,
|
Votes,
|
||||||
engine,
|
engine,
|
||||||
)
|
)
|
||||||
from sqlalchemy import select, true, update
|
from dakiny_bot.utils import (
|
||||||
from sqlalchemy.orm import Session
|
|
||||||
from utils import (
|
|
||||||
TEMPLATES_DIR,
|
TEMPLATES_DIR,
|
||||||
VoteType,
|
VoteType,
|
||||||
build_highcouncil_votes_str,
|
build_highcouncil_votes_str,
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
"""Contains various views to be used in the high council nomination process."""
|
"""Contains various views to be used in the high council nomination process."""
|
||||||
|
|
||||||
import nextcord
|
import nextcord
|
||||||
from DakinySettings import settings
|
|
||||||
from database_setup.sql_data_classes import CouncilMembers, engine
|
|
||||||
from nextcord.interactions import Interaction
|
from nextcord.interactions import Interaction
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from utils import (
|
|
||||||
|
from dakiny_bot.DakinySettings import settings
|
||||||
|
from dakiny_bot.database.sql_data_classes import CouncilMembers, engine
|
||||||
|
from dakiny_bot.utils import (
|
||||||
NOMINEE_SPLITTER,
|
NOMINEE_SPLITTER,
|
||||||
decorate_cl_nomination,
|
decorate_cl_nomination,
|
||||||
decorate_dm_nomination,
|
decorate_dm_nomination,
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
"""Contains various views to be used in the nomination process."""
|
"""Contains various views to be used in the nomination process."""
|
||||||
|
|
||||||
import nextcord
|
import nextcord
|
||||||
from DakinySettings import settings
|
|
||||||
from database_setup.sql_data_classes import CouncilMembers, engine
|
|
||||||
from nextcord.interactions import Interaction
|
from nextcord.interactions import Interaction
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from utils import NOMINEE_SPLITTER, decorate_nomination, get_election_name
|
|
||||||
|
from dakiny_bot.DakinySettings import settings
|
||||||
|
from dakiny_bot.database.sql_data_classes import CouncilMembers, engine
|
||||||
|
from dakiny_bot.utils import NOMINEE_SPLITTER, decorate_nomination, get_election_name
|
||||||
|
|
||||||
|
|
||||||
class NominateModal(nextcord.ui.Modal):
|
class NominateModal(nextcord.ui.Modal):
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
"""Contains various views to be used while voting for high council. Controls the logic when performing the vote."""
|
"""Contains various views to be used while voting for high council. Controls the logic when performing the vote."""
|
||||||
|
|
||||||
import nextcord
|
import nextcord
|
||||||
from DakinySettings import settings
|
from nextcord import SelectOption
|
||||||
from database_setup.sql_data_classes import (
|
from nextcord.interactions import Interaction
|
||||||
|
from sqlalchemy import exc, select, update
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
from dakiny_bot.DakinySettings import settings
|
||||||
|
from dakiny_bot.database.sql_data_classes import (
|
||||||
CouncilMembers,
|
CouncilMembers,
|
||||||
ElectionInformation,
|
ElectionInformation,
|
||||||
Votes,
|
Votes,
|
||||||
engine,
|
engine,
|
||||||
)
|
)
|
||||||
from nextcord import SelectOption
|
from dakiny_bot.utils import VoteType, build_highcouncil_votes_str, get_election_name
|
||||||
from nextcord.interactions import Interaction
|
|
||||||
from sqlalchemy import exc, select, update
|
|
||||||
from sqlalchemy.orm import Session
|
|
||||||
from utils import VoteType, build_highcouncil_votes_str, get_election_name
|
|
||||||
|
|
||||||
|
|
||||||
class VoteSelect(nextcord.ui.StringSelect):
|
class VoteSelect(nextcord.ui.StringSelect):
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
"""Contains various views to be used while voting. Controls the logic when performing the vote."""
|
"""Contains various views to be used while voting. Controls the logic when performing the vote."""
|
||||||
|
|
||||||
import nextcord
|
import nextcord
|
||||||
from DakinySettings import settings
|
from nextcord import SelectOption
|
||||||
from database_setup.sql_data_classes import (
|
from nextcord.interactions import Interaction
|
||||||
|
from sqlalchemy import exc, select, update
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
from dakiny_bot.DakinySettings import settings
|
||||||
|
from dakiny_bot.database.sql_data_classes import (
|
||||||
CouncilMembers,
|
CouncilMembers,
|
||||||
ElectionInformation,
|
ElectionInformation,
|
||||||
Votes,
|
Votes,
|
||||||
engine,
|
engine,
|
||||||
)
|
)
|
||||||
from nextcord import SelectOption
|
from dakiny_bot.utils import VoteType, build_votes_str, get_election_name
|
||||||
from nextcord.interactions import Interaction
|
|
||||||
from sqlalchemy import exc, select, update
|
|
||||||
from sqlalchemy.orm import Session
|
|
||||||
from utils import VoteType, build_votes_str, get_election_name
|
|
||||||
|
|
||||||
|
|
||||||
class VoteSelect(nextcord.ui.StringSelect):
|
class VoteSelect(nextcord.ui.StringSelect):
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ from fastapi import FastAPI
|
|||||||
from git import Repo
|
from git import Repo
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from classes.gitea_webhook import GiteaWebhook
|
from dakiny_bot.classes.gitea_webhook import GiteaWebhook
|
||||||
from DakinySettings import settings
|
from dakiny_bot.DakinySettings import settings
|
||||||
from utils import REPO_DIR, edit_clan_council_info, update_clan_messages
|
from dakiny_bot.utils import REPO_DIR, edit_clan_council_info, update_clan_messages
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import nextcord
|
import nextcord
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from cogs.commands.record import RecordCog
|
from dakiny_bot.cogs.commands.record import RecordCog
|
||||||
from cogs.commands.refresh import RefreshCog
|
from dakiny_bot.cogs.commands.refresh import RefreshCog
|
||||||
from cogs.commands.remove import RemoveCog
|
from dakiny_bot.cogs.commands.remove import RemoveCog
|
||||||
from cogs.commands.request import RequestCog
|
from dakiny_bot.cogs.commands.request import RequestCog
|
||||||
from cogs.commands.set import SetCog
|
from dakiny_bot.cogs.commands.set import SetCog
|
||||||
from cogs.commands.settings import SettingsCog
|
from dakiny_bot.cogs.commands.settings import SettingsCog
|
||||||
from cogs.commands.test import TestCog
|
from dakiny_bot.cogs.commands.test import TestCog
|
||||||
from cogs.commands.time import TimeCog
|
from dakiny_bot.cogs.commands.time import TimeCog
|
||||||
from cogs.commands.view import ViewCog
|
from dakiny_bot.cogs.commands.view import ViewCog
|
||||||
|
|
||||||
|
|
||||||
# This function will be called when this extension is loaded.
|
# This function will be called when this extension is loaded.
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import nextcord
|
|||||||
from discord import TextInputStyle
|
from discord import TextInputStyle
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from DakinySettings import settings
|
from dakiny_bot.DakinySettings import settings
|
||||||
from utils import GUILDS, MAX_DISCORD_MESSAGE_LENGTH, PointType, record_points
|
from dakiny_bot.utils import GUILDS, MAX_DISCORD_MESSAGE_LENGTH, PointType, record_points
|
||||||
|
|
||||||
|
|
||||||
class RecordCog(commands.Cog, name="Record Commands"):
|
class RecordCog(commands.Cog, name="Record Commands"):
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from pathlib import Path
|
|||||||
import nextcord
|
import nextcord
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from utils import MESSAGES_DIR, edit_clan_council_info, update_clan_messages
|
from dakiny_bot.utils import MESSAGES_DIR, edit_clan_council_info, update_clan_messages
|
||||||
|
|
||||||
|
|
||||||
class RefreshCog(commands.Cog, name="Refresh Commands"):
|
class RefreshCog(commands.Cog, name="Refresh Commands"):
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from nextcord.ext import commands
|
|||||||
from sqlalchemy import delete, select
|
from sqlalchemy import delete, select
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from database_setup.sql_data_classes import Presences, engine
|
from dakiny_bot.database.sql_data_classes import Presences, engine
|
||||||
|
|
||||||
|
|
||||||
class RemoveCog(commands.Cog, name="Remove Commands"):
|
class RemoveCog(commands.Cog, name="Remove Commands"):
|
||||||
@@ -54,14 +54,14 @@ class RemoveCog(commands.Cog, name="Remove Commands"):
|
|||||||
"""
|
"""
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
stmt = select(Presences)
|
stmt = select(Presences)
|
||||||
presences_dict: dict[str,str] = {pres.Presence: str(pres.Id) for pres in session.scalars(stmt)}
|
presences_dict: dict[str, str] = {pres.Presence: str(pres.Id) for pres in session.scalars(stmt)}
|
||||||
|
|
||||||
# if empty compare string
|
# if empty compare string
|
||||||
if not presence_str:
|
if not presence_str:
|
||||||
await interaction.response.send_autocomplete(dict(list(presences_dict.items())[:25]))
|
await interaction.response.send_autocomplete(dict(list(presences_dict.items())[:25]))
|
||||||
return
|
return
|
||||||
|
|
||||||
autofilled_presences: dict[str,str] = {
|
autofilled_presences: dict[str, str] = {
|
||||||
pres: pres_id for pres, pres_id in presences_dict.items() if presence_str.lower() in pres.lower()
|
pres: pres_id for pres, pres_id in presences_dict.items() if presence_str.lower() in pres.lower()
|
||||||
}
|
}
|
||||||
await interaction.response.send_autocomplete(autofilled_presences[:25])
|
await interaction.response.send_autocomplete(autofilled_presences[:25])
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import nextcord
|
|||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from DakinySettings import settings
|
from dakiny_bot.DakinySettings import settings
|
||||||
from database_setup.sql_data_classes import Presences, engine
|
from dakiny_bot.database.sql_data_classes import Presences, engine
|
||||||
|
|
||||||
|
|
||||||
class RequestCog(commands.Cog, name="Request Commands"):
|
class RequestCog(commands.Cog, name="Request Commands"):
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ from sqlalchemy import delete, select
|
|||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from database_setup.sql_data_classes import UserBirthday, engine
|
from dakiny_bot.app import birthday_list
|
||||||
from main import birthday_list
|
from dakiny_bot.database.sql_data_classes import UserBirthday, engine
|
||||||
|
|
||||||
|
|
||||||
class SetCog(commands.Cog, name="Set Commands"):
|
class SetCog(commands.Cog, name="Set Commands"):
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
import nextcord
|
import nextcord
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from DakinySettings import settings
|
from dakiny_bot.DakinySettings import settings
|
||||||
from utils import GUILDS
|
from dakiny_bot.utils import GUILDS
|
||||||
|
|
||||||
|
|
||||||
class SettingsCog(commands.Cog, name="Settings Commands"):
|
class SettingsCog(commands.Cog, name="Settings Commands"):
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
import nextcord
|
import nextcord
|
||||||
from nextcord.ext import application_checks, commands
|
from nextcord.ext import application_checks, commands
|
||||||
|
|
||||||
from classes.election import Election
|
from dakiny_bot.classes.election import Election
|
||||||
from DakinySettings import settings
|
from dakiny_bot.DakinySettings import settings
|
||||||
from utils import GUILDS, get_active_election_cycle, get_quarter_name
|
from dakiny_bot.utils import GUILDS, get_active_election_cycle, get_quarter_name
|
||||||
|
|
||||||
ME = 206602713511886849
|
ME = 206602713511886849
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from datetime import MAXYEAR, MINYEAR, UTC, datetime
|
|||||||
import nextcord
|
import nextcord
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from utils import GUILDS
|
from dakiny_bot.utils import GUILDS
|
||||||
|
|
||||||
|
|
||||||
class TimeCog(commands.Cog, name="Time Commands"):
|
class TimeCog(commands.Cog, name="Time Commands"):
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ from nextcord.ext import commands
|
|||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from database_setup.sql_data_classes import (
|
from dakiny_bot.database.sql_data_classes import (
|
||||||
Points,
|
Points,
|
||||||
Presences,
|
Presences,
|
||||||
Votes,
|
Votes,
|
||||||
engine,
|
engine,
|
||||||
)
|
)
|
||||||
from utils import GUILDS, MAX_DISCORD_MESSAGE_LENGTH, PointType, VoteType
|
from dakiny_bot.utils import GUILDS, MAX_DISCORD_MESSAGE_LENGTH, PointType, VoteType
|
||||||
|
|
||||||
|
|
||||||
class ViewCog(commands.Cog, name="View Commands"):
|
class ViewCog(commands.Cog, name="View Commands"):
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from cogs.loops.bot_presence import BotPresence
|
from dakiny_bot.cogs.loops.bot_presence import BotPresence
|
||||||
from cogs.loops.daily_loop import DailyLoop
|
from dakiny_bot.cogs.loops.daily_loop import DailyLoop
|
||||||
|
|
||||||
|
|
||||||
def setup(bot: commands.Bot) -> None:
|
def setup(bot: commands.Bot) -> None:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from nextcord.ext import commands, tasks
|
|||||||
from sqlalchemy import func, select
|
from sqlalchemy import func, select
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from database_setup.sql_data_classes import Presences, engine
|
from dakiny_bot.database.sql_data_classes import Presences, engine
|
||||||
|
|
||||||
|
|
||||||
class BotPresence(commands.Cog, name="Bot Presence"):
|
class BotPresence(commands.Cog, name="Bot Presence"):
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ from pytz import timezone
|
|||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from classes.election import Election
|
from dakiny_bot.app import birthday_list
|
||||||
from DakinySettings import settings
|
from dakiny_bot.classes.election import Election
|
||||||
from database_setup.sql_data_classes import UserBirthday, engine
|
from dakiny_bot.DakinySettings import settings
|
||||||
from main import birthday_list
|
from dakiny_bot.database.sql_data_classes import UserBirthday, engine
|
||||||
from utils import get_active_election_cycle
|
from dakiny_bot.utils import get_active_election_cycle
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import nextcord
|
import nextcord
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import nextcord
|
import nextcord
|
||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from main import birthday_list
|
from dakiny_bot.app import birthday_list
|
||||||
|
|
||||||
|
|
||||||
class SubmissionListener(commands.Cog, name="Message Listener"):
|
class SubmissionListener(commands.Cog, name="Message Listener"):
|
||||||
|
|||||||
+3
-2
@@ -12,8 +12,7 @@ import nextcord
|
|||||||
from sqlalchemy import select, true, update
|
from sqlalchemy import select, true, update
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
from DakinySettings import settings
|
from dakiny_bot.database.sql_data_classes import (
|
||||||
from database_setup.sql_data_classes import (
|
|
||||||
CouncilMembers,
|
CouncilMembers,
|
||||||
Messages,
|
Messages,
|
||||||
Points,
|
Points,
|
||||||
@@ -22,6 +21,8 @@ from database_setup.sql_data_classes import (
|
|||||||
engine,
|
engine,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from .DakinySettings import settings
|
||||||
|
|
||||||
NOMINEE_SPLITTER = "========================================\n\n"
|
NOMINEE_SPLITTER = "========================================\n\n"
|
||||||
REPO_DIR = "./dakiny-messages"
|
REPO_DIR = "./dakiny-messages"
|
||||||
MESSAGES_DIR = f"{REPO_DIR}/messages"
|
MESSAGES_DIR = f"{REPO_DIR}/messages"
|
||||||
|
|||||||
Reference in New Issue
Block a user