Ajaxy / telegram-tt

Telegram Web A, GPL v3
https://web.telegram.org/a
GNU General Public License v3.0
2.2k stars 462 forks source link

Inline keyboard on web telegram app gets stuck #343

Open teoring opened 5 months ago

teoring commented 5 months ago

When I am editing the inline keyboard with telegraf package ( nodejs ) editMessageText and editMessageReplyMarkup, it happens that Web Telegram App freezes showing previous keyboard and doesn't render a new inline keyboard.

Telegram App on Android always works reliably.

I've tried to find similar issue but didn't manage to. At this point I think this is an issue in Web Telegram App ( I tried both versions Z and K, both have the same behavior ).

telegraf: v4.15.3 nodejs: v16.20.2 OS: Ubuntu 20.04.6 LTS

I am using Scenes.WizardScene to switch between menus, trying to achieve similar behavior to what BotFather offers.

async function editOrReply( ctx, message, markup ) { try { if( ctx.session.lastMsgId ) { await ctx.editMessageText( message ); await ctx.editMessageReplyMarkup( markup.reply_markup ); } else { let tmsg = await ctx.reply( message, markup ); ctx.session.lastMsgId = tmsg.message_id; } } catch( err ) { let tmsg = await ctx.reply( message, markup ); ctx.session.lastMsgId = tmsg.message_id; } }

const wizard = new Scenes.WizardScene( constants.getHouseParametersScene(), async (ctx) => { await editOrReply( ctx, "What do you want to change?", kHParamsMenuMarkup ); return await ctx.scene.leave(); } );

This is what I see in debug logs when its getting stuck. It looks like telegraf successfully sends inline keyboard but web app doesn't render it.

telegraf:scenes:context Entering scene HP_MAIN_SCENE {} false +0ms telegraf:session-local Called function: telegraf:session-local -> /home/ashymanskyi/Development/utilities_and_research/crawlson/node_modules/telegraf-session-local/lib/session.js:176:12 telegraf:session-local -> Arguments: telegraf:session-local -> [] +6ms telegraf:session-local Next Middleware -> Key: 982433415:982433415 | Session: { __scenes: { current: 'HP_MAIN_SCENE', state: {}, cursor: 0 }, user: { _id: 982433415, max_house_price: 450000, min_living_area: 110, first_name: 'Artem', last_name: 'Shymanskyi', password: '$2b$10$nkdXy4hmyHJd3J308Mtt8.WPNxa5DF8WApj54AuMGgH5Kf/LOBGkG', telegram_notifications: true, min_construction_year: 1990, email_notifications: false, subscribed: true, travel_time_address: 'Helmond, Bogardeins 199', min_house_price: 245000, email: 'my_email@gmail.com', max_travel_time: 55, is_admin: true, subscribed_ts: 1706174474387, selected_cities: [ 'Helmond', 'Tilburg', 'Breda' ], commute_mode: 'walking', commute_mode_changed: 1703074871899, mute_tel_notif: true, mute_em_notif: false, expires_at: 1736414474386, min_energy_label: 'A', max_travel_distance: 5 }, editedField: 'max_house_price', scene: null, lastMsgId: 5245 } +0ms telegraf:session-local Called function: telegraf:session-local -> LocalSession.saveSession (/home/ashymanskyi/Development/utilities_and_research/crawlson/node_modules/telegraf-session-local/lib/session.js:123:10) telegraf:session-local -> Arguments: telegraf:session-local -> [ '982433415:982433415', { __scenes: { current: 'HP_MAIN_SCENE', state: {}, cursor: 0 }, user: { _id: 982433415, max_house_price: 450000, min_living_area: 110, first_name: 'Artem', last_name: 'Shymanskyi', password: '$2b$10$nkdXy4hmyHJd3J308Mtt8.WPNxa5DF8WApj54AuMGgH5Kf/LOBGkG', telegram_notifications: true, min_construction_year: 1990, email_notifications: false, subscribed: true, travel_time_address: 'Helmond, Bogardeins 199', min_house_price: 245000, email: 'my_email@gmail.com', max_travel_time: 55, is_admin: true, subscribed_ts: 1706174474387, selected_cities: [Array], commute_mode: 'walking', commute_mode_changed: 1703074871899, mute_tel_notif: true, mute_em_notif: false, expires_at: 1736414474386, min_energy_label: 'A', max_travel_distance: 5 }, editedField: 'max_house_price', scene: null, lastMsgId: 5245 } ] +1ms telegraf:session-local Saving session: 982433415:982433415 = { __scenes: { current: 'HP_MAIN_SCENE', state: {}, cursor: 0 }, user: { _id: 982433415, max_house_price: 450000, min_living_area: 110, first_name: 'Artem', last_name: 'Shymanskyi', password: '$2b$10$nkdXy4hmyHJd3J308Mtt8.WPNxa5DF8WApj54AuMGgH5Kf/LOBGkG', telegram_notifications: true, min_construction_year: 1990, email_notifications: false, subscribed: true, travel_time_address: 'Helmond, Bogardeins 199', min_house_price: 245000, email: 'my_email@gmail.com', max_travel_time: 55, is_admin: true, subscribed_ts: 1706174474387, selected_cities: [ 'Helmond', 'Tilburg', 'Breda' ], commute_mode: 'walking', commute_mode_changed: 1703074871899, mute_tel_notif: true, mute_em_notif: false, expires_at: 1736414474386, min_energy_label: 'A', max_travel_distance: 5 }, editedField: 'max_house_price', scene: null, lastMsgId: 5245 } +0ms telegraf:session-local -> Updating +0ms telegraf:main Finished processing update 927853533 +10ms telegraf:client HTTP call getUpdates { timeout: 50, offset: 927853534, allowed_updates: [] } +3s telegraf:client HTTP call sendMessage { chat_id: 982433415, message_thread_id: undefined, reply_markup: { inline_keyboard: [ [Array], [Array], [Array], [Array] ] }, text: 'Choose a command below.' } +1ms telegraf:scenes:context Leaving scene +143ms telegraf:client HTTP call getUpdates { timeout: 50, offset: 927853534, allowed_updates: [] } +50s

teoring commented 4 months ago

I think this has to do something with the load because in the morning it works very reliably but midday my inline keyboard just gets stuck.

dura0ok commented 2 months ago

Same, please fix it