Implemented #7
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Any
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from bson.errors import InvalidId
|
||||
@@ -64,13 +65,17 @@ class Event(Cog):
|
||||
|
||||
await validate_event_validity(ctx, name, start_date, end_date, guild_timezone)
|
||||
|
||||
processed_media: List[Dict[str, Any]] = (
|
||||
[] if thumbnail is None else await self.bot.process_attachments([thumbnail])
|
||||
)
|
||||
|
||||
event: PycordEvent = await self.bot.create_event(
|
||||
name=name,
|
||||
guild_id=guild.id,
|
||||
creator_id=ctx.author.id,
|
||||
starts=start_date.astimezone(ZoneInfo("UTC")),
|
||||
ends=end_date.astimezone(ZoneInfo("UTC")),
|
||||
thumbnail_id=thumbnail.id if thumbnail else None,
|
||||
thumbnail=processed_media[0] if thumbnail else None,
|
||||
)
|
||||
|
||||
# TODO Make a nice message
|
||||
@@ -138,12 +143,16 @@ class Event(Cog):
|
||||
|
||||
await validate_event_validity(ctx, name, start_date, end_date, guild_timezone)
|
||||
|
||||
processed_media: List[Dict[str, Any]] = (
|
||||
[] if thumbnail is None else await self.bot.process_attachments([thumbnail])
|
||||
)
|
||||
|
||||
await pycord_event.update(
|
||||
self.bot.cache,
|
||||
starts=start_date,
|
||||
ends=end_date,
|
||||
name=pycord_event.name if name is None else name,
|
||||
thumbnail_id=pycord_event.thumbnail_id if thumbnail is None else thumbnail.id,
|
||||
thumbnail=pycord_event.thumbnail if thumbnail is None else processed_media[0],
|
||||
)
|
||||
|
||||
# TODO Make a nice message
|
||||
|
Reference in New Issue
Block a user