Skip to content

feat: initial maxbattle tracking in poracle#929

Open
ReuschelCGN wants to merge 32 commits intoKartulUdus:developfrom
ReuschelCGN:maxbattle
Open

feat: initial maxbattle tracking in poracle#929
ReuschelCGN wants to merge 32 commits intoKartulUdus:developfrom
ReuschelCGN:maxbattle

Conversation

@ReuschelCGN
Copy link
Copy Markdown
Contributor

init PR for maxbattle tracking in poracle
(needs Golbat: https://github.com/UnownHash/Golbat/tree/stations-wh)
maxbattle tileserver templates, basic dts.json and poracle testdata are included
!poracle-test max-battle gmax
!poracle-test max-battle level3
!poracle-test max-battle level1

IMPORTANT:
this PR needs testing and feedback specially for the icons (i use the uicons.js from turtlesocks in poracle) and telegram

Maxbattle Tracking

!maxbattle d800 clean -> reports all "MaxbattleBossName" Maxbattles within 800 meters (d=distance in meters) of your set location and deletes the report after expiration
!maxbattle d500 gmax clean -> reports all "MaxbattleBossName" gmax battles within 500 meters (d=distance in meters) of your set location and deletes the report after expiration
!maxbattle level -> reports all Maxbattles with level "MaxbattleLevel" (possible Level: 1-8 where Level 6-8 are gmax Maxbattles)
!maxbattle remove -> removes "MaxbattleBossName" from the Maxbattle tracking
#available variables are: , level, move, gmax (only Gmax Battles), distance, clean

maxbattle

Comment thread src/app.js
}
if (!hook.message.poracleTest) {
fastify.webhooks.info(`max_battle ${JSON.stringify(hook.message)}`)
const cacheKey = `${hook.message.id}${hook.message.battle_end}${hook.message.battle_pokemon_id}`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The cache will expire well ahead of the max battle most probably, so this may not provide any value whatsoever.
What causes golbat to resend a station webhook and do we care that this will generate a new alert?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hook.message.id -> Station ID
hook.message.battle_end -> is eqal to end_time in golbat DB
hook.message.battle_pokemon_id -> if this change we get a new alert on same station

Why the cache should expire in normal use ahead of the max battle end?
But on Maxmondays or Events, it should gen. a new alert.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Jabes meant that you put an element into cache, but the cache itself lasts for x minutes?! Maybe an hour? So cache lookup will almost never happen

Golbat is not sending any duplicate hooks, it only sends if there something changes, like battle end, or Pokémon etc.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, the cache lasts an hour (I think). And the max battle has a duration much longer than that, so updates within the period will not be eliminated by the cache

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok so the cache could look like that:

const cacheKey = ${hook.message.id}${hook.message.battle_pokemon_id}``

Copy link
Copy Markdown
Contributor Author

@ReuschelCGN ReuschelCGN Aug 29, 2025

Choose a reason for hiding this comment

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

Rephrasing my question - are there any duplicate webhook messages that you are trying to avoid passing into the alerting engine?

Maxbattles have rotating moves and there are stationed mons which change, so i wanted to be sure, not to gen unnecessary alterts. But maybe im wrong with my thought.

Copy link
Copy Markdown
Contributor

@Fabio1988 Fabio1988 Aug 29, 2025

Choose a reason for hiding this comment

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

Max Monday would be such a case... For one hour there is a certain mon deployed... After that hour it changes back to the old one.... Golbat might send another hook
But the old mon can be already available for days, a one hour cache won't belp on that duplicate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we increase the cache for max battles to 2h? So we would safely not send a duplicate webhook on the 7PM change? :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

const cache = new NodeCache({ stdTTL: 5400, useClones: false }) // 90 minutes

looks like its gen. 90min cache

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm... As the first webhook could be sent the day before, we might still send another hook at 7PM... If I think about it, that's not that bad I guess

Do you have some notification examples for max monday or e.g. this event with Toxtricity?! :)

@Fabio1988
Copy link
Copy Markdown
Contributor

UnownHash/Golbat#312 merged

@jfberry
Copy link
Copy Markdown
Collaborator

jfberry commented Apr 11, 2026

Added to Poracle NG

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.

3 participants