-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: Include world and regionId as metadata with every notifier message #490
Conversation
I'm afraid I don't understand why the notifier tests would throw an NPE. Any insight would be appreciated. Thanks! |
not every notifier has the player's location defined, which causes an NPE when trying to get the region id - you can fix this by adding this line to when(localPlayer.getWorldLocation()).thenReturn(new WorldPoint(2500, 2500, 0)) (i just chose a random location) |
Thanks. Is the World already provided some way, or should that be added too? |
Since world is an int, mockito defaults that to 0 |
We should have an advanced config setting to be able to opt-out of sending this data. For the pk notifier, for example, we have with this new setting, the pk-specific setting could be removed. this would also require config migration code to set the new config value to false if the user set |
That makes sense. I'll take you up on that offer to have a maintainer implement that, if that's alright. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe update the changelog entry to clarify that this is enabled by default, and only accessible to non-discord webhooks, and make it a non-Dev entry
@Felanbird is it bad UX that pk notifier location setting is moved to advanced section without any clear indication? (i.e., should we have 2 config settings for this) |
I would say yes, I assume PKers would perpetrate the same issues as sweats and not read the version bump chat message, even if the only bump info was |
✅ tested in-game {
"type": "LOOT",
"playerName": "dankgg",
"accountType": "NORMAL",
"dinkAccountHash": "172d48fcbfce074e5385d67760091497dd5a761d97d19e871586ec54",
"content": "dankgg has looted: \n\n1 x Big bones (306)\n3 x Law rune (357)\n\nFrom: Moss giant",
"seasonalWorld": false,
"world": 393,
"regionId": 12698,
"extra": {
"items": [
{
"id": 532,
"quantity": 1,
"priceEach": 306,
"name": "Big bones"
},
{
"rarity": 0.03125,
"id": 563,
"quantity": 3,
"priceEach": 119,
"name": "Law rune"
}
],
"source": "Moss giant",
"category": "NPC",
"killCount": 2344,
"rarestProbability": 0.03125
}
} |
This pull request consists of changes that include a "world" and "regionId" property in the NotificationBody, so that they are included with every derived notification message. These properties are automatically populated in the DiscordMessageHandler if they hadn't been populated otherwise.
With the world property you can always know which world the notifying user is in, even after world hopping. (LoginNotifier does not act upon world hops), which allows for:
With the regionId property you can always know where in the world the notifying user is in, which allows for:
I believe the world and regionId to be very valuable context for various notifiers, and harmless enough to include with every notifier message by default.