Files
telegram-shop/src/handlers/adminHandlers/adminHandler.js
Artyom Ashirov 5d4f56e265 refactoring
2024-11-23 05:03:30 +03:00

30 lines
859 B
JavaScript

import config from '../../config/config.js';
import bot from "../../context/bot.js";
export default class AdminHandler {
static isAdmin(userId) {
return config.ADMIN_IDS.includes(userId.toString());
}
static async handleAdminCommand(msg) {
const chatId = msg.chat.id;
if (!this.isAdmin(msg.from.id)) {
await bot.sendMessage(chatId, 'Unauthorized access.');
return;
}
const keyboard = {
reply_markup: {
keyboard: [
['👥 Manage Users', '📦 Manage Products'],
['💰 Manage Wallets', '📍 Manage Locations'],
['💾 Database Backup']
],
resize_keyboard: true
}
};
await bot.sendMessage(chatId, 'Admin Panel:', keyboard);
}
}