Another back to admin fix
This commit is contained in:
parent
f504d5fb7b
commit
ebad9da439
@ -30,31 +30,4 @@ export default class AdminHandler {
|
||||
|
||||
await this.bot.sendMessage(chatId, 'Admin Panel:', keyboard);
|
||||
}
|
||||
|
||||
async handleAdminQueryCommand(callbackQuery) {
|
||||
if (!this.isAdmin(callbackQuery.from.id)) return;
|
||||
|
||||
const chatId = callbackQuery.message.chat.id;
|
||||
const messageId = callbackQuery.message.message_id;
|
||||
|
||||
const keyboard = {
|
||||
reply_markup: {
|
||||
keyboard: [
|
||||
['👥 Manage Users', '📦 Manage Products'],
|
||||
['💰 Manage Wallets', '📍 Manage Locations'],
|
||||
['💾 Database Backup']
|
||||
],
|
||||
resize_keyboard: true
|
||||
}
|
||||
};
|
||||
|
||||
await this.bot.editMessageText(
|
||||
`You we're returned to the admin menu`,
|
||||
{
|
||||
chat_id: chatId,
|
||||
message_id: messageId,
|
||||
reply_markup: keyboard
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
@ -278,4 +278,34 @@ export default class AdminLocationHandler {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async backToMenu(callbackQuery) {
|
||||
if (!this.isAdmin(callbackQuery.from.id)) return;
|
||||
|
||||
const chatId = callbackQuery.message.chat.id;
|
||||
const messageId = callbackQuery.message.message_id;
|
||||
|
||||
const keyboard = {
|
||||
reply_markup: {
|
||||
keyboard: [
|
||||
['👥 Manage Users', '📦 Manage Products'],
|
||||
['💰 Manage Wallets', '📍 Manage Locations'],
|
||||
['💾 Database Backup']
|
||||
],
|
||||
resize_keyboard: true
|
||||
}
|
||||
};
|
||||
|
||||
await this.bot.editMessageText(
|
||||
`You we're returned to the admin menu`,
|
||||
{
|
||||
chat_id: chatId,
|
||||
message_id: messageId,
|
||||
reply_markup: keyboard
|
||||
}
|
||||
);
|
||||
|
||||
this.userStates.delete(chatId);
|
||||
}
|
||||
}
|
@ -215,7 +215,8 @@ bot.on('callback_query', async (callbackQuery) => {
|
||||
logDebug(action, 'handleConfirmDelete');
|
||||
await adminLocationHandler.handleConfirmDelete(callbackQuery);
|
||||
} else if (action === 'admin_menu') {
|
||||
await adminHandler.handleAdminQueryCommand(callbackQuery);
|
||||
logDebug(action, 'backToMenu');
|
||||
await adminLocationHandler.backToMenu(callbackQuery);
|
||||
}
|
||||
|
||||
// Admin product management
|
||||
|
Loading…
Reference in New Issue
Block a user