Compare commits

...

2 Commits

Author SHA1 Message Date
0e4d6bc1f0 Add custom calendar properties
All checks were successful
continuous-integration/drone/push Build is passing
2022-09-08 18:09:04 +00:00
a5da3341b9 Fix changes in ics 0.8 2022-09-08 17:33:58 +00:00

View File

@ -6,7 +6,7 @@ from typing import Optional
from disnake import Client, Guild from disnake import Client, Guild
from dotenv import load_dotenv from dotenv import load_dotenv
from ics import Calendar, Event from ics import Calendar, ContentLine, Event
from ics.alarm import DisplayAlarm from ics.alarm import DisplayAlarm
from quart import Quart, redirect, render_template, request, url_for from quart import Quart, redirect, render_template, request, url_for
import sentry_sdk import sentry_sdk
@ -117,14 +117,19 @@ async def ical(guild_id: str):
calendar = Calendar() calendar = Calendar()
calendar.extra.append(ContentLine(name="NAME", value=guild.name))
calendar.extra.append(ContentLine(name="X-WR-CALNAME", value=guild.name))
if guild.description:
calendar.extra.append(ContentLine(name="DESCRIPTION", value=guild.description))
calendar.extra.append(ContentLine(name="X-WR-CALDESC", value=guild.description))
for scheduled_event in guild.scheduled_events: for scheduled_event in guild.scheduled_events:
event = Event() event = Event()
event.name = scheduled_event.name event.summary = scheduled_event.name
event.begin = scheduled_event.scheduled_start_time event.begin = scheduled_event.scheduled_start_time
event.end = ( event.end = scheduled_event.scheduled_end_time
scheduled_event.scheduled_end_time event.duration = timedelta(hours=2)
or scheduled_event.scheduled_start_time + 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 = f"https://discord.com/events/{guild_id}/{scheduled_event.id}"