-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
If bot tries to reply to a message that replied to another message of the bot, the bot crashes. #135
Comments
Hey, thanks for shooting this. I'm aware of the issue, but I'm not sure what's causing it. I'll investigate and get back to you as soon as I know more. Btw, this sounds like a bug. |
TLDR; this seems like an issue with the Telegram servers. I tried my best to replicate the error in multiple ways. I came to an interesting conclusion that this is actually a bug with the Telegram Bot API servers. What exactly is happening?As far as I know, incoming message updates from the General Topic have no Hence calling In the context of TeleverseAs of now (27/07/2023), Televerse has this implementation on the messageThreadId: messageThreadId ?? _msg.messageThreadId This was to solve #110, whenever an update is received Televerse library will automatically set the messageThreadId to the incoming message updates WorkaroundAs I checked, this exception can be handled by the handler passed to bot.onError((err, stackTrace) {
print("We got problems!");
/// handle it :)
});
bot.on(TeleverseEvent.text, (ctx) async {
ctx as MessageContext;
await ctx.reply("There we go...");
}); But well, to be honest, this isn't a real solution - this is just catching the exception. In other words, your bot is not really replying to the user's message in General Topic (if the message is replying to another message of the bot). So, I really don't suggest this one. Otherwise, you'll have to manually send a reply using the NoteI have raised an issue in the tdlib/telegram-bot-api repo about this issue. See it here: tdlib/telegram-bot-api#447 👨🏻💻 Tough DecisionThis leaves me with either two choices:
Hope this makes sense, regards :) |
This is fixed with a minor tweak. After the discussion with @levlam in tdlib/telegram-bot-api#447, I realized the Bot API has no bug and works as intended. So, added a minor tweak to pass This is released in V1.10.6. Thanks again for raising this @iamcosmin :) |
With this event handler, the bot will reply to every message you send.
Now, send a message, and the bot will reply to it.
Then, send another message, but reply to the message that the bot sent you.
The bot will crash with the following message:
The text was updated successfully, but these errors were encountered: