Fully documented and updated PycordEvent (#4)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from datetime import datetime
|
||||
from logging import Logger
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List
|
||||
from typing import Any, Dict, List, Optional
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from bson import ObjectId
|
||||
@@ -293,14 +293,19 @@ class PycordBot(LibPycordBot):
|
||||
return event_stage
|
||||
|
||||
# TODO Document this method
|
||||
async def find_event(self, event_id: str | ObjectId | None = None, event_name: str | None = None) -> PycordEvent:
|
||||
if event_id is None and event_name is None:
|
||||
raise AttributeError("Either event's ID or name must be provided!")
|
||||
async def find_event(
|
||||
self,
|
||||
event_id: Optional[str | ObjectId] = None,
|
||||
event_name: Optional[str] = None,
|
||||
guild_id: Optional[int] = None,
|
||||
) -> PycordEvent:
|
||||
if event_id is None or (event_name is None and guild_id is None):
|
||||
raise AttributeError("Either event ID or name with guild ID must be provided")
|
||||
|
||||
if event_id is not None:
|
||||
return await PycordEvent.from_id(event_id, cache=self.cache)
|
||||
else:
|
||||
return await PycordEvent.from_name(event_name, cache=self.cache)
|
||||
|
||||
return await PycordEvent.from_name(event_name, guild_id, cache=self.cache)
|
||||
|
||||
# TODO Document this method
|
||||
async def find_event_stage(self, stage_id: str | ObjectId) -> PycordEventStage:
|
||||
|
Reference in New Issue
Block a user