Add custom calendar properties
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2022-09-08 18:09:04 +00:00
parent a5da3341b9
commit 0e4d6bc1f0

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,6 +117,13 @@ 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.summary = scheduled_event.name event.summary = scheduled_event.name