Added more custom exceptions and prepared everything for documentation

This commit is contained in:
2025-04-27 12:39:30 +02:00
parent 6b143d8a2d
commit 638658af75
10 changed files with 146 additions and 53 deletions

View File

@@ -12,6 +12,7 @@ from libbot.pycord.classes import PycordBot as LibPycordBot
from typing_extensions import override
from classes import PycordEvent, PycordEventStage, PycordGuild, PycordUser
from classes.errors import EventStageMissingSequenceError
from modules.database import col_events, col_users
from modules.utils import get_logger
@@ -283,8 +284,7 @@ class PycordBot(LibPycordBot):
# event: PycordEvent = await self.find_event(event_id=kwargs["event_id"])
if "sequence" not in kwargs:
# TODO Create a nicer exception
raise RuntimeError("Stage must have a defined sequence")
raise EventStageMissingSequenceError()
event_stage: PycordEventStage = await PycordEventStage.create(**kwargs, cache=self.cache)
@@ -306,6 +306,7 @@ class PycordBot(LibPycordBot):
async def find_event_stage(self, stage_id: str | ObjectId) -> PycordEventStage:
return await PycordEventStage.from_id(stage_id, cache=self.cache)
# TODO Add documentation
@staticmethod
async def process_attachments(attachments: List[Attachment]) -> List[Dict[str, Any]]:
processed_attachments: List[Dict[str, Any]] = []