Fixed bot admin handling + modified README
This commit is contained in:
parent
9944b67edd
commit
33f76fd806
4 changed files with 16 additions and 19 deletions
|
@ -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 };
|
||||
}
|
||||
|
|
|
@ -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, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue