VDS13/telegram-inline-calendar

Error when trying to move through months

AguChaves92 opened this issue · 13 comments

So when I press the advance button to go to the next month nothing happens. it loads for a bit but neither the month nor the days change. And when i press it again, the bot simply crashes. Here is the error log:

image.

Also when I press the go back button it changes to january and skips february. And the it gets stuck on january and it cant advance back to march.

VDS13 commented

Could you show what package options you are using so I can simulate the situation?

here's the code
image
image

VDS13 commented

here's the code

image

image

Always on the same press? Many factors can play here: CPU load, Internet speed, problems on the telegram side, my badly optimized code :)

VDS13 commented

Try like this:

bot.on("callback_query", (ctx) => {
    if (ctx.callbackQuery.message.message_id == calendar.chats.get(ctx.callbackQuery.message.chat.id)) {
        res = calendar.clickButtonCalendar(ctx.callbackQuery);
        if (res !== -1) {
            ctx.reply("You selected: " + res);
        }
    }
});

would a video of the behaviour help?

WhatsApp.Video.2023-03-03.at.3.41.11.PM.mp4

this is with the code you passed.

VDS13 commented

would a video of the behaviour help?

WhatsApp.Video.2023-03-03.at.3.41.11.PM.mp4

this is with the code you passed.

Can you try using a different Telegram Bot Api? I want to understand if the problem will repeat with another API, because I can not reproduce the problem.

VDS13 commented

The problem is most likely related to slow internet or api.telegram response.

I can't speak for the telegram api, but my internet isn´t as slow as to cause this kind of issues. But I don't know

VDS13 commented

Could you try using node-telegram-bot-api or grammy for testing? This is required to understand if the problem occurs when using other libraries. If the problem does not manifest itself, I will make changes to the package.

Ill try today and see what happens. Ill report back then

VDS13 commented

@AguChaves92, Are you using type: "module"? If yes, then at the moment the library does not support ESM, in the near future I will release an update to work with ESM.

VDS13 commented

@AguChaves92, can you try using the following version: npm i telegram-inline-calendar@ecmascript?

VDS13 commented

@AguChaves92, If you managed to make everything work, please consider closing this issue.