langel / botb_irc_bot

battle of the bits instant relay chat magic
BSD 3-Clause "New" or "Revised" License
11 stars 7 forks source link

add exact time when the battle starts + timezones #91

Closed viraxor closed 2 years ago

viraxor commented 2 years ago

Added time when the competition starts, along with timezone support.

Example:

<viraxor> !ohb
<BotB2_tes>  OHB "vav's lunchbreak xhb #29" :: Starting in: 12h 29m 17s (21:29) :: Format: wildchip :: <https://battleofthebits.org/arena/Battle/7082/>
<viraxor> !ohb gmt+1
<BotB2_tes>  OHB "vav's lunchbreak xhb #29" :: Starting in: 12h 28m 38s (22:29) :: Format: wildchip :: <https://battleofthebits.org/arena/Battle/7082/>  
<viraxor> !ohb utc-1
<BotB2_tes>  OHB "vav's lunchbreak xhb #29" :: Starting in: 12h 27m 25s (20:29) :: Format: wildchip :: <https://battleofthebits.org/arena/Battle/7082/>  
jangler commented 2 years ago

Have you considered using a Unix timestamp instead? Discord will display <t:1650721883:t> as e.g. 9:51 AM if you're in US eastern, 6:51 AM if you're in US Pacific, etc.

jangler commented 2 years ago

I suppose that's not of much use to IRC users, though…

viraxor commented 2 years ago

I suppose that's not of much use to IRC users, though…

Is it even possible to somehow do it through IRC without the users giving their timezone as a parameter?

langel commented 2 years ago

I don't really understand the "timezone support". Does it always show the target military time in GMT? Does discord automagically adjust time displays when they are wrapped with ()? Does a discord user need to opt in to this feature or does discord already know their timezone based on cornputer settings? Are the users on IRC going to see the wrong time unless they live along the prime meridian line?

viraxor commented 2 years ago

I don't really understand the "timezone support". Does it always show the target military time in GMT? Does discord automagically adjust time displays when they are wrapped with ()? Does a discord user need to opt in to this feature or does discord already know their timezone based on cornputer settings? Are the users on IRC going to see the wrong time unless they live along the prime meridian line?

The timezone support means that you can type in your timezone and get exact time for your timezone, not just giving 22:40 UTC to every user, so they calculate the time for their timezone.

I plan on adding more timezones like EST and CET.

Discord does automatically convert UTC time to time in your timezone, but, unfortunately, IRC doesn't have this functionality.

Discord does know your timezone based on your computer settings, and, as far as I know, correct me if I'm not right, there is no way to turn it off.

The IRC users will have to know their timezone against UTC for now. But, as I mentioned above, I will add different generalized timezones.

viraxor commented 2 years ago

This pull request is (finally) ready to get merged.