DreamExposure / DisCal-Discord-Bot

DisCal is a Discord Bot that links up to a Google Calendar to create, delete, edit, and announce events and more!
GNU General Public License v3.0
112 stars 44 forks source link

Rework add external calendar flow #113

Open NovaFox161 opened 3 years ago

NovaFox161 commented 3 years ago

I was working on converting the existing !addCal command to a slash command, and in the process realized trying to shoehorn this in as a command just isn't going to work, especially with WIP features such as supporting other hosting providers.

Due to the fact that in order to authorize the bot to a 3rd party website, the user would have to leave the discord client anyway, so having this done through the discal website completely would be more optimal than going back and force between the discord client and one (or multiple) websites.

The process I believe would be best is as follows:

A user with elevated permissions runs the /addcal command, if the server can add a new calendar, it will send an ephemeral message to the user with a link to discal's site; something like https://www.discalbot.com/dashboard/$guild-id/calendar/new?type=external&step=0 On that page, it will prompt the user to login to the discal site through their discord account (to verify their permission status among other things). After logging in, they will be redirected back to the page, where it will show buttons for authorizing access to the different hosts (google/apple/outlook/etc). They will be sent to the respective oauth2 pages to authorize discal access, and will once again be redirected back to discal's site at https://www.discalbot.com/dashboard/$guild-id/calendar/new?type=external&step=1 where they will be presented with a selection for all of the calendars on the account that have correct permissions for discal to work with. They can select the calendar they wish to add, and the page will confirm the selection and once the backend does its checks, tell the user that the process is complete.

If there's an error, it will be shown to the user in an alert or similar fashion to tell them what may have gone wrong.

This solves the problem of trying to stick all this logic inside of a command system and how to handle displaying calendar choices in an understandable fashion while keeping things somewhat simple.

Opinions please? Thanks~

smnc commented 3 years ago

Makes a lot of sense and would probably make for a simpler flow for users. I like it.