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

Align the webhook format with RocketMap #199

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions monocle/notification.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import datetime, timedelta, timezone
from collections import deque
from base64 import b64encode
from math import sqrt
from time import monotonic, time
from pkg_resources import resource_stream
Expand Down Expand Up @@ -773,13 +774,15 @@ async def webhook(self, pokemon):
tth = pokemon['earliest_tth']
ts = pokemon['seen'] + tth

eid = b64encode(bytes(str(pokemon['encounter_id']), 'UTF-8'))
spid = hex(pokemon['spawn_id']).split('x')[-1] if conf.SPAWN_ID_INT else pokemon['spawn_id']
data = {
'type': "pokemon",
'message': {
"encounter_id": pokemon['encounter_id'],
"encounter_id": eid,
"pokemon_id": pokemon['pokemon_id'],
"last_modified_time": pokemon['seen'] * 1000,
"spawnpoint_id": pokemon['spawn_id'],
"spawnpoint_id": spid,
"latitude": pokemon['lat'],
"longitude": pokemon['lon'],
"disappear_time": ts,
Expand Down