Wandering-Cursor / ontu-schedule-bot

Still in BETA - A bot for gettings schedule of ONTU
MIT License
2 stars 0 forks source link

[FR] Add Google Calendar API integration #32

Open makisukurisu opened 9 months ago

makisukurisu commented 9 months ago

Add integration with Google Calendar API. As an example, make it possible to add a weekly schedule to the calendar.

I think that you can add an additional button to the message /schedule

Monday Tuesday Wednesday Thursday Friday Add schedule to calendar

It is call function that will generate url and redirect user to web page with google auth and add calendar, or generate link for add to calendar

Originally posted by @hikionori in https://github.com/makisukurisu/ontu-schedule-bot/issues/31#issuecomment-1716081183

makisukurisu commented 2 weeks ago
# https://calendar.google.com/calendar/render?action=TEMPLATE&text=Example+Google+Calendar+Event&details=More+help+see:+https://support.google.com/calendar/thread/81344786&dates=20201231T160000/20201231T170000&recur=RRULE:FREQ%3DWEEKLY

import urllib.parse

base_url = "https://calendar.google.com/calendar/render"

params = {
    "action": "TEMPLATE",
    "text": "Ababagalamaga",
    "details": "Перейдіть https://google.com/test для отримання додаткової інформації.",
    "dates": "20240620T155200/20240620T155300",  # YYYYMMDDTHHMMSS/YYYYMMDDTHHMMSS,
    "ctz": "Europe/Kiev",
}

final_url = base_url + "?" + urllib.parse.urlencode(params)

print(final_url)

This seems to work. Though, adding whole schedule will be tricky most likely.

makisukurisu commented 1 week ago

Hi, @hikionori, Since that was your request initially, I'd like to hear your opinion first.

I see two ways of solving this issue:

The latter is what was originally requested, and what is waaay more convenient to the end user. But it also requires having a web-site with some UI so people can hit that button and add pairs.

I have no problems making one, but this will clearly take some time. Is it worth the effort, or is adding pairs manually good enough? Let me know.

Sorry for the wait, by the way, I've finally got some free time and energy to spend on this project.

makisukurisu commented 1 week ago

Well, obviously there's a third option - close this issue and pretend it never existed, if no one really needs this. Let me know anyway. Here, or in DM's in Telegram, or in a channel/group: https://t.me/ontu_schedule_bot_channel