Closed Kardbord closed 2 years ago
Some "gotchas" to bear in mind:
See also #59?
This might be a good use case for Modal interactions. See #55.
So after doing some research, the plan for this features is going to have to change a bit.
Making constant API requests, even at 1 minute intervals, is not going to scale well. Even if it's only for one or two messages, there's a good chance of being rate limited which will impact the UX at best and get my bot banned from the Discord API gateway at worst. Luckily DiscordGo does a good job of only sending requests at the allowed rate limit.
To mitigate the rate limiting issue, this will have to be a "server clock" feature, where only one is allowed per server. Were this a larger bot, that probably wouldn't be enough to dodge the rate limiting issue, but since the bot is not publicly hosted I think I can get away with it for now.
The Discord API does not (and should not) provide user time zones. The server admin creating the clock will just have to provide a list of time zones they're interested in.
So, the new vision I have for server clock functionality is this:
Guild admins can issue /time zone server
, and provide a list of IANA time zones to average, as well as a name for the custom time zone. This will create (or replace an existing) read-only server channel. The name of the channel will be as given in the command, along with the date and time for the custom time zone. Within that channel, the bot will post a single message containing 1) The date and time of the custom time zone, and 2) the date and time of each time zone used in the calculation of the custom time zone. That message and channel name will update every one minute to reflect the current date and time. To reiterate - there may be one such channel per server.
This is an excellent suggestion from one of the bot's users.
Allow guild admins to create an averaged (or median?) timezone for certain members, optionally associate the TZ with a role.
To create a timezone, something like the following:
To add a user to the timezone:
To remove a timezone:
Create a message which updates itself every minute with the current time: