shayaantx / botdarr

Slack/Discord/Telegram/Matrix bot for accessing radarr, sonarr, and lidarr
GNU General Public License v3.0
157 stars 12 forks source link

Telegram does not work #48

Closed JulyIghor closed 2 years ago

JulyIghor commented 2 years ago

Telegram now requires int64 support, please fix it.

2022-Jan-08 16:13:30 PM [pool-3-thread-1] ERROR com.botdarr.scheduling.Scheduler - Error during api notification com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: Expected an int but was 5018879350 at line 1 column 60 path $.result.from.id at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:228) ~[botdarr-release.jar:?] at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:218) ~[botdarr-release.jar:?] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131) ~[botdarr-release.jar:?] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222) ~[botdarr-release.jar:?] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131) ~[botdarr-release.jar:?] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222) ~[botdarr-release.jar:?] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131) ~[botdarr-release.jar:?] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222) ~[botdarr-release.jar:?] at com.google.gson.Gson.fromJson(Gson.java:927) ~[botdarr-release.jar:?] at com.google.gson.Gson.fromJson(Gson.java:892) ~[botdarr-release.jar:?] at com.google.gson.Gson.fromJson(Gson.java:841) ~[botdarr-release.jar:?] at com.pengrad.telegrambot.impl.TelegramBotClient.send(TelegramBotClient.java:65) ~[botdarr-release.jar:?] at com.pengrad.telegrambot.TelegramBot.execute(TelegramBot.java:42) ~[botdarr-release.jar:?] at com.botdarr.clients.telegram.TelegramChatClient.sendTelegramMessage(TelegramChatClient.java:57) ~[botdarr-release.jar:?] at com.botdarr.clients.telegram.TelegramChatClient.lambda$sendMessage$1(TelegramChatClient.java:41) ~[botdarr-release.jar:?] at com.botdarr.clients.telegram.TelegramChatClient.sendMessages(TelegramChatClient.java:86) ~[botdarr-release.jar:?] at com.botdarr.clients.telegram.TelegramChatClient.sendMessage(TelegramChatClient.java:39) ~[botdarr-release.jar:?] at com.botdarr.clients.telegram.TelegramChatClient.sendToConfiguredChannels(TelegramChatClient.java:93) ~[botdarr-release.jar:?] at com.botdarr.api.sonarr.SonarrApi$2.sendToConfiguredChannels(SonarrApi.java:94) ~[botdarr-release.jar:?] at com.botdarr.api.PeriodicNotificationStrategy.sendPeriodicNotifications(PeriodicNotificationStrategy.java:24) ~[botdarr-release.jar:?] at com.botdarr.api.sonarr.SonarrApi.sendPeriodicNotifications(SonarrApi.java:96) ~[botdarr-release.jar:?] at com.botdarr.scheduling.Scheduler.lambda$initApiNotifications$0(Scheduler.java:29) ~[botdarr-release.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_312] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_312] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_312] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_312] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_312] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_312] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312] Caused by: java.lang.NumberFormatException: Expected an int but was 5018879350 at line 1 column 60 path $.result.from.id at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1172) ~[botdarr-release.jar:?] at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:226) ~[botdarr-release.jar:?] ... 28 more

shayaantx commented 2 years ago

ill setup telegram again and investigate/fix, I'm currently sick atm so there is a chance I won't get to it this wekeend

shayaantx commented 2 years ago

so I looked into a bit this morning, so far it does seem the error is related using int over int64, however its not clear from the json parsing error which field needs to be changed. If I had to guess its message id, since com.pengrad.telegrambot.model.Message#message_id is still a int.

I was not able to reproduce by triggering notifications from any endpoint, since all the ids are normal ints (as I just setup a fresh telegram channel and I don't have any old ones to reproduce large message ids). However I modified some json with a longer message id and see the error

image

I'm trying to see if I can workaround this via the library I use, if I can't find a workaround can you debug following line when a notification that triggers the error is sent so we can get exact json triggering the failure (so we know which fields are breaking). Then I can make an issue/PR here https://github.com/pengrad/java-telegram-bot-api

com.pengrad.telegrambot.impl.TelegramBotClient#send

image

Will post back soon, sorry for the inconvenience

JulyIghor commented 2 years ago

I'm using newly created bot and new group. Also error appears when I'm writing to the group, so it can't read commands but it can send messages

shayaantx commented 2 years ago

I'm using newly created bot and new group. Also error appears when I'm writing to the group, so it can't read commands but it can send messages

Hmm in my local setup I see it reading and sending messages, do you have some time tomorrow to troubleshoot live? maybe on discord or gchat?

Or if you wanna email me the telegram.log file, that might help.

JulyIghor commented 2 years ago

sure, maybe Telegram? t.me/ighor

JulyIghor commented 2 years ago

telegram.log zero size

shayaantx commented 2 years ago

fix is here https://github.com/shayaantx/botdarr/pull/49, just need to write a few test cases tomorrow, then I'll merge/push out a new release.