RITlug / teleirc

Go implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group
https://docs.teleirc.com/
GNU General Public License v3.0
134 stars 46 forks source link

teleirc failing when image uploads to imgur #423

Open 21h opened 2 days ago

21h commented 2 days ago

when in telegram someone posts image or group of images teleirc failing. I already tried to use my own API key but no result.

may be imgur or telegram api updated?

INFO: 2024/06/28 16:00:03 Current TeleIRC version:
INFO: 2024/06/28 16:00:03 Creating new Telegram bot client...
INFO: 2024/06/28 16:00:03 Creating new IRC bot client...
INFO: 2024/06/28 16:00:03 Starting up Telegram bot...
INFO: 2024/06/28 16:00:03 Starting up IRC bot...
INFO: 2024/06/28 16:00:04 Authorized on account IRCTelegramRetranslatorBot
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x80 pc=0x6e8f63]

goroutine 35 [running]:
github.com/ritlug/teleirc/internal/handlers/telegram.getImgurLink(0xc00023e000, 0xc00065e0e0, 0x64, 0x0, 0x0)
/opt/teleirc/internal/handlers/telegram/imgur.go:101 +0x5a3
github.com/ritlug/teleirc/internal/handlers/telegram.uploadImage(0xc00023e000, 0x3a44274a, 0xc000128b40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/opt/teleirc/internal/handlers/telegram/helpers.go:68 +0xe5
github.com/ritlug/teleirc/internal/handlers/telegram.photoHandler(0xc00023e000, 0x3a44274a, 0xc000128b40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/opt/teleirc/internal/handlers/telegram/handler.go:162 +0x65
github.com/ritlug/teleirc/internal/handlers/telegram.updateHandler(0xc00023e000, 0xc000274a20)
/opt/teleirc/internal/handlers/telegram/handler.go:45 +0x378
github.com/ritlug/teleirc/internal/handlers/telegram.(*Client).StartBot(0xc00023e000, 0xc0002a0000, 0xc00023e040)
/opt/teleirc/internal/handlers/telegram/telegram.go:78 +0x245
created by main.main
/opt/teleirc/cmd/teleirc.go:53 +0x58d
Tjzabel commented 2 days ago

Wow that's a big issue. Thank you for submitting.

Tjzabel commented 2 days ago

@21h this will have to require more testing. I was not able to reproduce this issue.

21h commented 2 days ago

ok, I added some logging and got this

body request {"errors":[{"id":"legacy-api-847cd4ffc9-nv4h6/mIS2d3TwHp-1299764","code":"429","status":"Too Many Requests","detail":"Too Many Requests"}]}

strange, I'm using my own imgur credentials wih envs:

  IMGUR_CLIENT_ID: "..."
  IMGUR_CLIENT_SECRET: "....."
21h commented 2 days ago

only after use of all 4 imgur envs teleirc uploads images normally.

may be add into docs what options is minimal required? and more logging

Tjzabel commented 1 day ago

@21h you only need the IMGUR_CLIENT_ID. The main culprit seems to be the "Too Many Requests". I'm assuming imgur is getting too many requests from that particular IP range your teleirc bridge is hosted on? Doesn't seem to be an issue on our end.