v4: Personal calendar #168

Merged
Xefir merged 5 commits from v4 into master 2023-11-07 00:40:58 +00:00
Showing only changes of commit f795637848 - Show all commits

View File

@ -231,7 +231,7 @@ async def subscribe(entity_id: str):
return redirect(url_for(".login")) return redirect(url_for(".login"))
def make_event(scheduled_event: GuildScheduledEvent, guild_id: int) -> Event: def make_event(scheduled_event: GuildScheduledEvent) -> Event:
event = Event() event = Event()
event.summary = scheduled_event.name event.summary = scheduled_event.name
@ -240,7 +240,7 @@ def make_event(scheduled_event: GuildScheduledEvent, guild_id: int) -> Event:
event.duration = timedelta(hours=2) event.duration = timedelta(hours=2)
event.uid = str(scheduled_event.id) event.uid = str(scheduled_event.id)
event.description = scheduled_event.description event.description = scheduled_event.description
event.url = f"https://discord.com/events/{guild_id}/{scheduled_event.id}" event.url = scheduled_event.url
event.location = ( event.location = (
scheduled_event.entity_metadata.location scheduled_event.entity_metadata.location
if scheduled_event.entity_metadata if scheduled_event.entity_metadata
@ -276,7 +276,7 @@ async def ical(entity_id: str):
) )
for scheduled_event in guild.scheduled_events: for scheduled_event in guild.scheduled_events:
event = make_event(scheduled_event, guild.id) event = make_event(scheduled_event)
calendar.events.append(event) calendar.events.append(event)
return calendar.serialize() return calendar.serialize()
@ -301,7 +301,7 @@ async def ical(entity_id: str):
member.id member.id
for member in await scheduled_event.fetch_users().flatten() for member in await scheduled_event.fetch_users().flatten()
]: ]:
event = make_event(scheduled_event, guild.id) event = make_event(scheduled_event)
calendar.events.append(event) calendar.events.append(event)
return calendar.serialize() return calendar.serialize()