update user and admin wallet function

This commit is contained in:
NW
2024-12-23 20:44:56 +00:00
parent a970a188db
commit 3129525a1e
7 changed files with 369 additions and 36 deletions

View File

@@ -12,6 +12,7 @@ import adminUserLocationHandler from "./handlers/adminHandlers/adminUserLocation
import adminDumpHandler from "./handlers/adminHandlers/adminDumpHandler.js";
import adminLocationHandler from "./handlers/adminHandlers/adminLocationHandler.js";
import adminProductHandler from "./handlers/adminHandlers/adminProductHandler.js";
import adminWalletsHandler from "./handlers/adminHandlers/adminWalletsHandler.js";
// Debug logging function
const logDebug = (action, functionName) => {
@@ -129,6 +130,11 @@ bot.on('message', async (msg) => {
await adminDumpHandler.handleDump(msg);
}
break;
case '💰 Manage Wallets':
if (adminHandler.isAdmin(msg.from.id)) {
await adminWalletsHandler.handleWalletManagement(msg);
}
break;
}
} catch (error) {
await ErrorHandler.handleError(bot, msg.chat.id, error, 'message handler');
@@ -333,6 +339,20 @@ bot.on('callback_query', async (callbackQuery) => {
logDebug(action, 'handleEditUserDistrict');
await adminUserLocationHandler.handleEditUserDistrict(callbackQuery)
}
// Admin Wallet management
else if (action.startsWith('wallet_type_')) { // Добавляем обработку выбора типа кошелька
logDebug(action, 'handleWalletTypeSelection');
await adminWalletsHandler.handleWalletTypeSelection(callbackQuery);
} else if (action.startsWith('prev_page_') || action.startsWith('next_page_')) {
logDebug(action, 'handlePagination');
await adminWalletsHandler.handlePagination(callbackQuery);
} else if (action.startsWith('export_csv_')) {
logDebug(action, 'handleExportCSV');
await adminWalletsHandler.handleExportCSV(callbackQuery);
} else if (action === 'back_to_wallet_types') {
logDebug(action, 'handleWalletManagement');
await adminWalletsHandler.handleWalletManagement(msg);
}
// Dump manage
else if (action === "export_database") {
await adminDumpHandler.handleExportDatabase(callbackQuery);
@@ -341,6 +361,13 @@ bot.on('callback_query', async (callbackQuery) => {
await adminDumpHandler.handleImportDatabase(callbackQuery);
}
// Transaction history
else if (action.startsWith('view_transaction_history_')) {
logDebug(action, 'handleTransactionHistory');
const page = parseInt(action.split('_').pop()); // Extract page number
await userWalletsHandler.handleTransactionHistory(callbackQuery, page);
}
await bot.answerCallbackQuery(callbackQuery.id);
} catch (error) {
await ErrorHandler.handleError(bot, msg.chat.id, error, 'callback query');