Personal Telegram developer console for GitHub

fix: restore main menu callback fallback (#57)

davoodmehraban89 committed Oct 7, 2026 at 08:01 UTC fd6ea8492b65fc2e983f5d4caf32ad29fe167e67
2 files changed +21
src/bot-legacy.js
+5
@@ -204,6 +204,11 @@ export class NexaDevBot {
204 isOwner: true,
205 ownerId: ownerId === undefined || ownerId === null ? '' : String(ownerId)
206 });
207 + if (!routed) {
208 + const view = await this.menu.renderByCallback(data);
209 + const res = await this.telegram.editMessageText(chatId, messageId, view.text, view.reply_markup);
210 + return { ok: true, edited: true, callbackAnswered, res };
211 + }
212 if (routed?.requiresApproval) {
213 const approval = routed.approval;
214 const repoId = approval?.input?.repoId;
test/bot.test.js
+16
@@ -192,6 +192,22 @@ describe('Nexa Dev Bot - Webhook Dispatcher & In-Place Editing', () => {
192 assert.equal(edits[0].text, 'routed project');
193 });
194
195 + it('menu:main falls back to local menu when no plugin route claims it', async () => {
196 + const bot = makeBot();
197 + const edits = [];
198 + bot.telegram.answerCallbackQuery = async () => ({ ok: true });
199 + bot.router.dispatchCallback = async () => null;
200 + bot.telegram.editMessageText = async (chatId, messageId, text, replyMarkup) => {
201 + edits.push({ chatId, messageId, text, replyMarkup });
202 + return { ok: true };
203 + };
204 + const res = await bot.handleUpdate({ callback_query: { id: 'cb_main_local', data: 'menu:main', from: { id: 123456 }, message: { message_id: 501, chat: { id: 123456 } } } });
205 + assert.equal(res.ok, true);
206 + assert.equal(res.edited, true);
207 + assert.equal(edits.length, 1);
208 + assert.match(edits[0].text, /Nexa Dev Bot/);
209 + });
210 +
211 it('callback navigation still edits when answerCallbackQuery fails', async () => {
212 const editedMessages = [];
213 const bot = makeBot();