admin access
This commit is contained in:
parent
2beaa324fa
commit
93290dee1c
@ -1,12 +1,18 @@
|
||||
import db from '../config/database.js';
|
||||
import Validators from '../utils/validators.js';
|
||||
import config from "../config/config.js";
|
||||
|
||||
export default class AdminUserLocationHandler {
|
||||
constructor(bot) {
|
||||
this.bot = bot;
|
||||
}
|
||||
|
||||
isAdmin(userId) {
|
||||
return config.ADMIN_IDS.includes(userId.toString());
|
||||
}
|
||||
|
||||
async handleEditUserLocation(callbackQuery) {
|
||||
if (!this.isAdmin(callbackQuery.from.id)) return;
|
||||
|
||||
const userId = callbackQuery.data.replace('edit_user_location_', '');
|
||||
const chatId = callbackQuery.message.chat.id;
|
||||
const messageId = callbackQuery.message.message_id;
|
||||
@ -55,6 +61,8 @@ export default class AdminUserLocationHandler {
|
||||
}
|
||||
|
||||
async handleEditUserCountry(callbackQuery) {
|
||||
if (!this.isAdmin(callbackQuery.from.id)) return;
|
||||
|
||||
const chatId = callbackQuery.message.chat.id;
|
||||
const messageId = callbackQuery.message.message_id;
|
||||
const [country, userId] = callbackQuery.data.replace('edit_user_country_', '').split("_");
|
||||
@ -90,6 +98,8 @@ export default class AdminUserLocationHandler {
|
||||
}
|
||||
|
||||
async handleEditUserCity(callbackQuery) {
|
||||
if (!this.isAdmin(callbackQuery.from.id)) return;
|
||||
|
||||
const chatId = callbackQuery.message.chat.id;
|
||||
const messageId = callbackQuery.message.message_id;
|
||||
const [country, city, userId] = callbackQuery.data.replace('edit_user_city_', '').split('_');
|
||||
@ -125,6 +135,8 @@ export default class AdminUserLocationHandler {
|
||||
}
|
||||
|
||||
async handleEditUserDistrict(callbackQuery) {
|
||||
if (!this.isAdmin(callbackQuery.from.id)) return;
|
||||
|
||||
const chatId = callbackQuery.message.chat.id;
|
||||
const messageId = callbackQuery.message.message_id;
|
||||
const [country, city, district, userId] = callbackQuery.data.replace('edit_user_district_', '').split('_');
|
||||
|
Loading…
Reference in New Issue
Block a user