Professor-Redwood-Team / Professor-Redwood

Pokemon Go Discord Bot
MIT License
34 stars 21 forks source link

Unable to adjust time difference. #101

Closed Alterraia closed 5 years ago

Alterraia commented 5 years ago

I run 2 versions of the bot off of a Raspberry Pi. The Pi is located in CA and uses local PST. No issues with that bot, Professor Sequoia.

I moved Maryland, so I'm on EST, and there's no organized PoGo group here. So, I cloned the bot, made the changes like I did for Sequoia, to work for this area.

Problem is, that when running !egg or !raid command, the bot replies with a time from PST.

I combed through all bot files searching for "date" and "time", and found 2 files which might have an impact:

node_modules > discord.js > src > client > rest > RequestHandlers > Burst.js and Sequential.js

They both have something that says:

And below that:

this.timeDifference = 0;

I thought that if I changed the 0 to a 3, that would be enough, but the bot running for MD is still using PST.

Is there something more I need to do for it to register the time difference?

Is there something I can add that will make the difference?

This is the one thing holding me back from going live.

kc135576 commented 5 years ago

That might be an issue with the way we get our timestamp since that's configured to the system time. Is your Maryland bot running on the same pi?

Also, closing this PR, since this is more of a discussion (issue).

Alterraia commented 5 years ago

Yes, it's running on the same Pi because there's plenty of space there. I didn't want my Eureka group to be offline for a week while I moved.

I was hoping that the system time, being PST, just needed to have the time difference added, giving it the +3 needed.

On Thu, Mar 14, 2019 at 3:42 PM Kenneth Chan notifications@github.com wrote:

Closed #101 https://github.com/Professor-Redwood-Team/Professor-Redwood/pull/101.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Professor-Redwood-Team/Professor-Redwood/pull/101#event-2204597298, or mute the thread https://github.com/notifications/unsubscribe-auth/AkZ6m5ah7mmTMtw0UQRNjalS-9u1N1UXks5vWqY0gaJpZM4b1C6T .

pbk01 commented 5 years ago

The Date() object used in the !egg and !raid commands is core javascript, and I don't think it is affected by any setting in the discord.js package. Since Date() .getHours() and .getMinutes() methods use the Pi local timezone, I would recommend incorporating a timezone offset into the constants.js data object and re-writing the format_time function to incorporate .getUTCHours() and the timezone offset.

Alterraia commented 5 years ago

date.setHours( date.getHours() + 3 );

Was the resolution Slackey found. Entered under line 82 in raid.js and line 74 in egg.js.

This will resolve any time issues or should.

Thanks for feedback.

On Thu, Mar 14, 2019 at 18:56 pbk01 notifications@github.com wrote:

The Date() object used in the !egg and !raid commands is core javascript, and I don't think it is affected by any setting in the discord.js package. Since Date() .getHours() and .getMinutes() methods use the Pi local timezone, I would recommend incorporating a timezone offset into the constants.js data object and re-writing the format_time function to incorporate .getUTCHours() and the timezone offset.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Professor-Redwood-Team/Professor-Redwood/pull/101#issuecomment-473096899, or mute the thread https://github.com/notifications/unsubscribe-auth/AkZ6mxs_8zzLEoUJTYviO54B6YiurEchks5vWtOKgaJpZM4b1C6T .