Coder Social home page Coder Social logo

versx / whmgr Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 27.0 23.87 MB

Discord notification system that works with RealDeviceMap and reports Pokemon, Raids, Eggs, Quests, Pokestop Lures, Team Rocket Invasions, Gym team changes, and Weather as embed messages. Discord users can also subscribe to custom Pokemon, Raid, Quest, Team Rocket Invasion, and Pokestop Lure notifications via direct message (DM) with predefined requirements.

C# 54.10% JavaScript 0.01% Batchfile 0.13% Shell 0.13% Dockerfile 0.03% CSS 4.11% HTML 0.08% TypeScript 41.40%

whmgr's Introduction

Hi there ๐Ÿ‘‹

I'm versx, I like to code.

Metrics

GitHub Streak
versx's wakatime stats

Languages:
My Languages

Skills:
My Skills

Internet of Things:
My Languages

Integrated Development Environments:
My Skills

Storage:
My Skills

Current Main Project:
ChuckDeviceController

whmgr's People

Contributors

arcanoxdragon avatar bschultz avatar ccev avatar clburlison avatar davispogo avatar dependabot[bot] avatar dergelm avatar hunch-13 avatar kbtbc avatar lenisko avatar m4d40 avatar pizzamann113 avatar skoodat avatar snyk-bot avatar thunder123456 avatar versx avatar xerockxmg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

whmgr's Issues

[Bug] Webhooks can sometimes cause thread safety-related exceptions

I was noticing after a user subscribed to PvP notifications that the bot was throwing a good amount of exceptions from the ParsePokemon method of HttpServer:

1:03 AM [ERROR] [HTTP] System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at WhMgr.Net.HttpServer.ParsePokemon(Object message) in /home/whmgr/WhMgr/src/Net/HttpServer.cs:line 350

This made my log file get massive overnight.

The only time an IndexOutOfRangeException can be thrown from Dictionary<,>.Add is if more than one thread is writing to it at once, or a thread tries to write to it while another is reading. This can be solved with a lock(...) { } block around the relevant access to these dictionaries while processing webhooks.

[Feature] Allow to specify own address format for Google Maps and Nominatim

Instead using Nominatim API display_name allow user to define own address objects to return from config file.

Example json with data:
https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=50.6661563&lon=17.926697773752586

Related part in code:

return new Location(Convert.ToString(obj.display_name), city ?? unknown, Convert.ToDouble(obj.lat), Convert.ToDouble(obj.lon));

[Bug] Pokemon GO cell_id can sometimes be larger than long.MaxValue

I encountered a System.OverflowException in the testing environment in which I'm testing WhMgr right now because there are Pokestops in our system with a cell_id greater than long.MaxValue, which was causing issues reading Pokestop models from the database. Changing Pokestop.CellId to ulong fixed the issue. I will be submitting a PR to fix this soon; just wanted to file an issue too for the sake of formality.

Pause/Resume by Subscription Type

Currently, pause/resume is only available globally. We should add support for pausing/resuming each type individually - Invasions, Lures, Pokemon, PVP, Raids, Quests, etc.

Expand Geofence capabilities to allow non-Alarm geofences to be used for DMs and to support GeoJSON

I am currently helping test out WhMgr on a Discord server I'm a part of as a potential replacement for another bot. While I was setting up a test instance of WhMgr, I was having issues getting any DMs sent even though I could tell that webhooks were being fired on the bot and some of them should have matched my subscriptions. I went through and debugged the WhMgr project so I could step through the notification processing code, and noticed that it was bailing because there were no Geofences loaded despite me having files in the geofences folder. It appears as though Geofences are only loaded if an Alarm references them in its geofence list. I would preferably like to use the DM feature of WhMgr right now without any actual alarms set up.

To me, it would make sense to iterate through the files in the geofences folder at the same time that the Alarms are loaded (in the constructor of WebhookController). It doesn't seem that the geofences for DM notifications are in any way related to Alarm geofences except that geofence files are only loaded if an Alarm mentions them.

I can submit a PR for this if this is an acceptable change to make.

Raid Subscription by Gym

Subscriptions for raids should have an option for subscribing by gym that does NOT modify all of your current raid Pokemon subscriptions.

Gym posts

WhMgr Gym posts cannot be controlled by any filter. WhMgr post everything regardless of the parameters in the gym filter.

Ability to add multiple pokeme subscriptions for the same pokemon

I'm not sure if this is a feature request or a bug report, but basically, is it possible to make the following work...

note: this is based on a current PR where you don't notify by area and instead do it by location/distance if no city/area is specified.

.pokeme all 100
.pokeme all 100 30 * all

So I would like notifications of all 100iv pokemon within the configured distance of my location and I would like notifications of all 100iv / level 30+ pokemon within all configured cities/areas.
When testing, it seems the 2nd command overwrites the entries in the pokemon db table that were created by the first one.

Unhandled exception - Crash on Empty Shiny Report

Bot started midnight routine, and crashed when the Shiny report was empty.

Trace report:
11:59 PM [DEBUG] [BOT] MIDNIGHT 5/25/2020 11:59:59 PM
11:59 PM [DEBUG] [BOT] Starting automatic quest messages cleanup...
11:59 PM [DEBUG] [BOT] Posting shiny stats for guild MyGuild (#guildid#) in channel #ChannelID#
12:00 AM [DEBUG] [BOT] Unhandled exception caught.
12:00 AM [ERROR] [BOT] System.ArgumentException: Cannot send empty message
at DSharpPlus.Net.DiscordApiClient.d__39.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at WhMgr.Bot.d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at WhMgr.Bot.<<-ctor>b__7_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b__6_1(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

Separate Raid/Egg Filter Issue

I have two filters one for eggs and one for raid filters. They were reporting to two separate channels before.
.
However the separate filters won't function as expected.
The filter works if Eggs and Raids are both set to true to one channel.
However the egg filter will not work when I separate the filters to two different channels.

I don't know if the manager thinks the messages are duplicated when it isn't.

{
"eggs":
{
"enabled": false,
"min_lvl": 1,
"max_lvl": 4
},
"raids":
{
"enabled": true,
"min_lvl": 1,
"max_lvl": 4,
"pokemon": [],
"type": "Exclude",
"ignoreMissing": false
}
}

{
"eggs":
{
"enabled": true,
"min_lvl": 1,
"max_lvl": 4
},
"raids":
{
"enabled": false,
"min_lvl": 1,
"max_lvl": 4,
"pokemon": [],
"type": "Exclude",
"ignoreMissing": false
}
}

Filter lures by type

Feature Request to be able to filter Lures by Type enabling the separation of lures into specific channels.

[Feature Change] Enhance feedme/feemenot & role control

Per our discussion in Discord, now that DM subs are entirely independent of 'city roles':

  • Cities should be renamed to Areas or Zones (or something else everyone likes, configurable even?) as many of us use roles for different neighborhoods/subareas of the cities we serve and the feedme/feedmenot functions added to it's own WhMgr-UI section.

  • Upon donor role loss, any roles given via the bot should be removed (and stored for easy restoral in DB?) along with the DM sub pausing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.