WatWowMap / ReactMap

Pokemon GO Map frontend built with React
MIT License
123 stars 62 forks source link

feat: add config to set scanner cooldown by role #1014

Open SherlockSometimes opened 3 months ago

SherlockSometimes commented 3 months ago

Add discordRoleCooldown to scanNext and scanZone config to set cooldown per user role

example config (scanZone accepts the same format) "scanNext": { ... // Discord roles that will be allowed to use scanNext "discordRoles": ["Supporter","Scanner", "Mod"], // Default cooldown if no role specific cooldown "userCooldownSeconds": 60, //List of role/cooldown pair shortest matching time will apply "discordRoleCooldown":[["Supporter",30],["Mod",0]], ... }

Expected outcome: Supporter: 30 second cooldown Mod: 0 second cooldown Scanner: will get the default 60 second cooldown. Supporter & Mod role: the lower 0 second cooldown would apply.

SherlockSometimes commented 3 months ago

Didn't add the telegram part, I could add it but it would be untested as I don't use telegram, I can look at it tommorow if so, but figured id post the tested code and do that seperatly. Wasn't sure if 'rules' needed to be added to 'Permissions' also as its part of the permSet object, so left it out for now. Also added admin users get 0 cooldown as they skip the permission loop and would just get the default value.

SherlockSometimes commented 3 months ago

Switched to nullish ?? operator as 0 == false and would set default value when a 0 cooldown role was set. Added telegram, it compiled and ran but no other testing was done with it.