Implemented /stage edit and /stage delete (#2)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from logging import Logger
|
||||
from typing import Any
|
||||
from typing import Any, override
|
||||
|
||||
from bson import ObjectId
|
||||
from discord import Guild, User
|
||||
@@ -43,6 +43,14 @@ class PycordBot(LibPycordBot):
|
||||
if "cache" in self.config and self.config["cache"]["type"] is not None:
|
||||
self.cache = create_cache_client(self.config, self.config["cache"]["type"])
|
||||
|
||||
@override
|
||||
async def start(self, *args: Any, **kwargs: Any) -> None:
|
||||
await super().start(*args, **kwargs)
|
||||
|
||||
@override
|
||||
async def close(self, **kwargs) -> None:
|
||||
await super().close(**kwargs)
|
||||
|
||||
async def find_user(self, user: int | User) -> PycordUser:
|
||||
"""Find User by its ID or User object.
|
||||
|
||||
@@ -100,16 +108,11 @@ class PycordBot(LibPycordBot):
|
||||
|
||||
event_stage: PycordEventStage = await PycordEventStage.create(**kwargs, cache=self.cache)
|
||||
|
||||
await event.insert_stage(event_stage._id, kwargs["sequence"], cache=self.cache)
|
||||
await event.insert_stage(self, event_stage._id, kwargs["sequence"], cache=self.cache)
|
||||
|
||||
return event_stage
|
||||
|
||||
async def start(self, *args: Any, **kwargs: Any) -> None:
|
||||
await super().start(*args, **kwargs)
|
||||
|
||||
async def close(self, **kwargs) -> None:
|
||||
await super().close(**kwargs)
|
||||
|
||||
# TODO Document this method
|
||||
async def find_event(self, event_id: str | ObjectId | None = None, event_name: str | None = None):
|
||||
if event_id is None and event_name is None:
|
||||
raise AttributeError("Either event's ID or name must be provided!")
|
||||
@@ -118,3 +121,7 @@ class PycordBot(LibPycordBot):
|
||||
return await PycordEvent.from_id(event_id, cache=self.cache)
|
||||
else:
|
||||
return await PycordEvent.from_name(event_name, cache=self.cache)
|
||||
|
||||
# TODO Document this method
|
||||
async def find_event_stage(self, stage_id: str | ObjectId) -> PycordEventStage:
|
||||
return await PycordEventStage.from_id(stage_id, cache=self.cache)
|
||||
|
Reference in New Issue
Block a user