Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A quotation message caused the bot to fail the parsing #190

Closed
2 tasks done
ForNeVeR opened this issue Feb 5, 2024 · 3 comments · Fixed by #194
Closed
2 tasks done

A quotation message caused the bot to fail the parsing #190

ForNeVeR opened this issue Feb 5, 2024 · 3 comments · Fixed by #194
Assignees
Labels

Comments

@ForNeVeR
Copy link
Member

ForNeVeR commented Feb 5, 2024

Happened today. Here's what I see in the logs:

{"Timestamp":"2024-02-05T09:18:33.3673418+00:00","Level":"Information","MessageTemplate":"Telegram actor spawning…","Properties":{"EventCategory":"Telegram"}}
{"Timestamp":"2024-02-05T09:18:33.3976361+00:00","Level":"Information","MessageTemplate":"Telegram actor starting ({Path})…","Properties":{"Path":"akka://emulsion/user/core/telegram","EventCategory":"Telegram"}}

It seems the container was restarted at that time, for whatever reason, and the newly-spawned instance was unable to get any messages from Telegram.

Exceptions may be logged incorrectly. Here's what I see in the docker logs:

ApiResponseException: expected:',', actual:'p', at offset:1137 in {"ok":true,"result":[{"update_id":372875371,
"message":{"message_id":189640,"from":{"id":999999999,"is_bot":false,"first_name":"PPPPP","last_name":"VVVVVVV","username":"sssssssssssssss"},"chat":{"id":-1111111111111,"title":"IIIIIIII","username":"pppppppppppppp","type":"supergroup"},"date":1111111111,"message_thread_id":111111,"reply_to_message":{"message_id":189632,"from":{"id":61251188,"is_bot":false,"first_name":"AAAAAAAAA","username":"eeeeeeeeeeeee","is_premium":true},"chat":{"id":-1111111111111,"title":"IIIIIIII","username":"pppppppppppppp","type":"supergroup"},"date":1707117257,"message_thread_id":111111,"quote":{"text":"\u043d\u0443 \u044f \u0431\u0440\u0430\u043b \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u0430\u044f (\u0433\u0434\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u043f\u043e\u0434 Fn), \u043d\u043e \u0438 \u0447\u0442\u043e\u0431\u044b \u0431\u0435\u0437 numpad. \u044f \u0436\u0435 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0442\u0430\u043c Ins\\","position":9,"is_manual":true},"text":"\u0430 \u0441\u043a\u0438\u043d\u044c \u0444\u043e\u0442\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430"},"photo":[{"file_id":"xxx","file_unique_id":"xxx","file_size":1743,"width":90,"height":67},{"file_id":"xxx","file_unique_id":"xxx","file_size":25340,"width":320,"height":240},{"file_id":"AgACAgIAAx0CQHbgfQABAuTIZcC2cd2HlQ3VuWVwjbhhjnNlgyUAAtLWMRt4TAhK2BrVNrtOhKoBAAMCAAN4AAM0BA","file_unique_id":"AQAD0tYxG3hMCEp9","file_size":109607,"width":800,"height":600},{"file_id":"xxx","file_unique_id":"xxx-","file_size":218265,"width":1280,"height":960}]}}]}. Code: -1

It seems there's an error in this place: Ins\\","posi

Are we parsing the JSON incorrectly, or is it incorrect by itself? Should figure out later. Perhaps update Funogram to a version that supports quotes?

TODO

  • Fix the parsing issue, somehow
  • Figure out the exception handling
@ForNeVeR ForNeVeR self-assigned this Feb 5, 2024
@ForNeVeR
Copy link
Member Author

ForNeVeR commented Feb 5, 2024

The full message I've got from getUpdates directly and preserved locally as T:\Temp\message.json

It, indeed, looks invalid

@ForNeVeR
Copy link
Member Author

ForNeVeR commented Feb 5, 2024

Steps to reproduce.

  1. Send a Tg message:
    ну я брал чтобы не совсем урезанная (где стрелки под Fn), но и чтобы без numpad. я же не проверял наличие там Ins\
    
    (note the trailing slash)
  2. Send a Tg message quoting the previous one, e.g.
    > ну я брал чтобы не совсем урезанная (где стрелки под Fn), но и чтобы без numpad. я же не проверял наличие там Ins\
    а скинь фото, пожалуйста
    
  3. The bot will endlessly spam into stdout a message about invalid JSON. Nothing will work.

@ForNeVeR
Copy link
Member Author

ForNeVeR commented Feb 5, 2024

Caused by neuecc/Utf8Json#63.

@ForNeVeR ForNeVeR changed the title Telegram actor respawn caused everything to be stuck A quotation message caused the bot to fail the parsing Feb 5, 2024
ForNeVeR added a commit that referenced this issue Feb 5, 2024
ForNeVeR added a commit that referenced this issue Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant