Compare commits
2 Commits
e4d6bc90bd
...
0e4d6bc1f0
Author | SHA1 | Date | |
---|---|---|---|
0e4d6bc1f0 | |||
a5da3341b9 |
@ -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}"
|
||||||
|
Loading…
Reference in New Issue
Block a user