Fixed bot admin handling + modified README

This commit is contained in:
A Bunch of Computer Nerds 2024-12-08 21:47:32 -03:00
parent 9944b67edd
commit 33f76fd806
4 changed files with 16 additions and 19 deletions

View file

@ -9,7 +9,7 @@ async function collectInfo(ctx) {
const userId = parseInt(ctx.message.text.split(' ')[1], 10);
const admins = await ctx.telegram.getChatAdministrators(chatId);
const isAdmin = admins.some(admin => admin.user.id === adminId);
const onCrew = process.env.botAdmins.includes(adminId);
const onCrew = JSON.parse("[" + process.env.botAdmins + "]");
return { Strings, chatId, userId, isAdmin, onCrew };
}

View file

@ -53,7 +53,8 @@ function getSystemInfo() {
async function handleAdminCommand(ctx, action, successMessage, errorMessage) {
const Strings = getStrings(ctx.from.language_code);
const userId = ctx.from.id;
if (process.env.botAdmins.includes(userId)) {
const adminArray = JSON.parse("[" + process.env.botAdmins + "]");
if (adminArray.includes(userId)) {
try {
await action();
ctx.reply(successMessage, {