Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc. Changes #23

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Misc. Changes #23

wants to merge 12 commits into from

Conversation

HexKing74
Copy link

  1. Configurable "working dir"
  2. Change webhook to send actual type (egg or raid)
  3. Change webhook to resend when changing from egg to raid
  4. Parse end time from hatched raids when not previously scanned as egg

…ng & re-send of webhook when changing from egg to raid
raidnearby.py Outdated
@@ -658,6 +680,8 @@ def processRaidImage(self, raidfilename):

pokemon_id = database.get_raid_pokemon_id(session, gym)
end_time = database.get_raid_time(session, gym)
if end_time == 0:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to be
if end_time < unix_time:
end_time will be previous raid end time for most people with RDRM.

Copy link
Author

@HexKing74 HexKing74 Sep 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. because the gym may have had a previous raid and that old value will be returned. hadn't thought about that one. just started using this and we don't get many raids in my county

raidnearby.py Outdated
@@ -658,6 +680,8 @@ def processRaidImage(self, raidfilename):

pokemon_id = database.get_raid_pokemon_id(session, gym)
end_time = database.get_raid_time(session, gym)
if end_time == 0:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new end_time is only being sent to webhook and not written to the database?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would probably need to modify one of the database methods (maybe update_raid_mon), or add a new one, and pass the value. I'm only using this code for webhooks so I didn't notice the DB wasn't already being updated

Need to add USE_RAIDBOSS_TIMER to config.example.py
@@ -758,21 +787,10 @@ def processRaidImage(self, raidfilename):

def send_webhook(self, fort_id, lvl, poke_id, end, type_):
battle_start = end
if fort_id in wh_send_dict:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need someone to review these send_webhook changes.

form = wh_send_dict[fort_id]["form"]
wh_send_dict[fort_id]["poke_id"] = poke_id
#Need to resend the webook if changing from egg to raid, or if raid is from a different time
if fort_id in wh_send_dict and wh_send_dict[fort_id]["end"] == end and wh_send_dict[fort_id]["type"] == type_:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end is not in the wh_send_dict this would lead to a KeyError

you first have to add it in line 807-817

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I missed that when I was copying my changes to the github clone

raidnearby.py Outdated
end_time_temp = self.getEndTime(file_update_time, time_text)
if end_time_temp != -1:
end_time = end_time_temp
hatch_time = end_time - 6300
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should that not be 2700 instead of 6300?
The db routine works from "hatch time"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. It’s hatch_time, so 2700.

@SenorKarlos
Copy link

While testing the boss timer changes yesterday and today Pokealarm is encountering errors while receiving egg payloads. Something has improper values.

2018-09-09 07:31:29,982 [DEBUG][ pokealarm][ webserver] Received 1 event(s) from my.ip.was.here.
2018-09-09 07:31:29,997 [ERROR][ external][ Events] Encountered error while converting webhook data(ValueError: Webhook kind was not an expected value.)
2018-09-09 07:31:29,997 [DEBUG][ external][ Events] Stack trace:
Traceback (most recent call last):
File "C:\PokeAlarm\PokeAlarm\Events_init_.py", line 41, in event_factory
raise ValueError("Webhook kind was not an expected value.")
ValueError: Webhook kind was not an expected value.

Apparently I missed adding both of the items to the dict
 Rolled back Raid Egg webhook for PokeAlarm compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants