versx / WhMgr

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.
25 stars 27 forks source link

v5 donor roles #189

Closed clburlison closed 2 years ago

clburlison commented 2 years ago
This works however obviously not having pvp, raids, etc is painful.
  "donorRoleIds": {
    "533370661150654466": ["pokemon"],
    "789208867619864586": ["pokemon"]
  },

This breaks. Anytime you have more than one permission enabled in the array
  "donorRoleIds": {
    "533370661150654466": ["pokemon", "pokestops", "pvp", "raids", "quests", "invasions", "lures", "gyms"],
    "789208867619864586": ["pokemon", "pokestops", "pvp", "raids", "quests", "invasions", "lures", "gyms"]
  },

This is the json error when you have multiple permissions enabled

Unhandled exception. System.Text.Json.JsonException: The JSON value could not be converted to System.Collections.Generic.List`1[WhMgr.Configuration.SubscriptionAccessType]. Path: $.donorRoleIds.533370661150654466[1] | LineNumber: 14 | BytePositionInLine: 49.
   at System.Text.Json.ThrowHelper.ThrowJsonException(String message)
   at System.Text.Json.Serialization.Converters.EnumConverter`1.ReadWithQuotes(Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.EnumConverter`1.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.Converters.DictionaryDefaultConverter`3.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, Type returnType, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
   at WhMgr.Extensions.JsonExtensions.FromJson[T](String json) in /home/whmgr/test/src/Extensions/JsonExtensions.cs:line 16
   at WhMgr.Configuration.Config.LoadDiscordServers() in /home/whmgr/test/src/Configuration/Config.cs:line 197
   at WhMgr.Configuration.Config.Load(String filePath) in /home/whmgr/test/src/Configuration/Config.cs:line 260
   at WhMgr.Program.<>c.<CreateHostBuilder>b__1_0(IWebHostBuilder webBuilder) in /home/whmgr/test/src/Program.cs:line 28
   at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.<>c__DisplayClass0_0.<ConfigureWebHostDefaults>b__0(IWebHostBuilder webHostBuilder)
   at Microsoft.Extensions.Hosting.GenericHostWebHostBuilderExtensions.ConfigureWebHost(IHostBuilder builder, Action`1 configure, Action`1 configureWebHostBuilder)
   at Microsoft.Extensions.Hosting.GenericHostWebHostBuilderExtensions.ConfigureWebHost(IHostBuilder builder, Action`1 configure)
   at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.ConfigureWebHostDefaults(IHostBuilder builder, Action`1 configure)
   at WhMgr.Program.CreateHostBuilder(String[] args) in /home/whmgr/test/src/Program.cs:line 21
   at WhMgr.Program.Main(String[] args) in /home/whmgr/test/src/Program.cs:line 17
versx commented 2 years ago

:eyes: I'll look into this, haven't had this issue tbh.

versx commented 2 years ago

Honestly can't reproduce the issue, having all keys in the array I receive those subscription items, if I remove raids I no longer receive them.

versx commented 2 years ago

Should be fixed in v5.0.2

clburlison commented 2 years ago

Confirmed this has fixed