From 0e4d6bc1f01b00451ad2b7e0f17acf98f4883bec Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Thu, 8 Sep 2022 18:09:04 +0000 Subject: [PATCH] Add custom calendar properties --- divent/bot.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/divent/bot.py b/divent/bot.py index 03726b7..2482239 100644 --- a/divent/bot.py +++ b/divent/bot.py @@ -6,7 +6,7 @@ from typing import Optional from disnake import Client, Guild from dotenv import load_dotenv -from ics import Calendar, Event +from ics import Calendar, ContentLine, Event from ics.alarm import DisplayAlarm from quart import Quart, redirect, render_template, request, url_for import sentry_sdk @@ -117,6 +117,13 @@ async def ical(guild_id: str): 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: event = Event() event.summary = scheduled_event.name