goat
command
admin
๐๐ฑ๐ฑ, ๐ฟ๐ฒ๐บ๐ผ๐๐ฒ ๐ผ๐ฟ ๐๐ถ๐ฒ๐ ๐๐ต๐ฒ ๐ฎ๐ฑ๐บ๐ถ๐ป ๐น๐ถ๐๐
0
views
0
likes
0
installs
Aliases: ad
raw source
const { config } = global.GoatBot;
const { writeFileSync } = require("fs-extra");
module.exports = {
config: {
name: "admin",
aliases: ["ad"],
version: "1.1",
author: "Azadx69x",
countDown: 5,
role: 0,
shortDescription: {
en: "๐๐ฑ๐ฑ, ๐ฟ๐ฒ๐บ๐ผ๐๐ฒ ๐ผ๐ฟ ๐๐ถ๐ฒ๐ ๐๐ต๐ฒ ๐ฎ๐ฑ๐บ๐ถ๐ป ๐น๐ถ๐๐"
},
longDescription: {
en: "๐ ๐ฎ๐ป๐ฎ๐ด๐ฒ ๐ฏ๐ผ๐ ๐ฎ๐ฑ๐บ๐ถ๐ป๐ โ ๐ฎ๐ฑ๐ฑ/๐ฟ๐ฒ๐บ๐ผ๐๐ฒ/๐๐ถ๐ฒ๐"
},
category: "admin",
guide: {
en:
`๐ต ๐จ๐๐ฎ๐ด๐ฒ:
{pn} ๐น๐ถ๐๐
{pn} ๐ฎ๐ฑ๐ฑ <uid|tag|reply>
{pn} ๐ฟ๐ฒ๐บ๐ผ๐๐ฒ <uid|tag|reply>`
}
},
langs: {
en: {
listAdmin:
`โโโโโโจ ๐๐๐๐๐ ๐๐๐๐ โจโโโโโ
โช ๐พ๐๐ฝ๐ด๐: RSโข RIFAT.ยฅ
โ โโโโโโโโโโโโโโโโโโโโฃ
๐ ๐ฐ๐๐๐๐ ๐ป๐๐๐:
%1
โโโโโโโโโโโโโโโโโโโโโ`,
noAdmin: "โ ๏ธ | ๐ฝ๐ ๐ฐ๐๐๐๐๐ ๐ต๐๐๐๐!",
added:
`โ ๐ก๐ฒ๐ ๐๐ฑ๐บ๐ถ๐ป๐ ๐๐ฑ๐ฑ๐ฒ๐ฑ:
โโโโโโโโโโโโโโโโ
%2
โโโโโโโโโโโโโโโโ`,
alreadyAdmin:
`โ ๏ธ ๐๐น๐ฟ๐ฒ๐ฎ๐ฑ๐ ๐๐ฑ๐บ๐ถ๐ป:
โโโโโโโโโโโโโโโโ
%2
โโโโโโโโโโโโโโโโ`,
removed:
`โ ๐๐ฑ๐บ๐ถ๐ป ๐ฃ๐ฟ๐ถ๐๐ถ๐น๐ฒ๐ด๐ฒ ๐ฅ๐ฒ๐บ๐ผ๐๐ฒ๐ฑ:
โโโโโโโโโโโโโโโโ
%2
โโโโโโโโโโโโโโโโ`,
notAdmin:
`โ ๏ธ ๐ก๐ผ๐ ๐๐ป ๐๐ฑ๐บ๐ถ๐ป:
โโโโโโโโโโโโโโโโ
%2
โโโโโโโโโโโโโโโโ`,
missingIdAdd: "โ ๏ธ | ๐ง๐ฎ๐ด/๐ฟ๐ฒ๐ฝ๐น๐/๐จ๐๐ ๐ป๐ฒ๐ฒ๐ฑ๐ฒ๐ฑ ๐๐ผ ๐ฎ๐ฑ๐ฑ ๐ฎ๐ฑ๐บ๐ถ๐ป.",
missingIdRemove: "โ ๏ธ | ๐ง๐ฎ๐ด/๐ฟ๐ฒ๐ฝ๐น๐/๐จ๐๐ ๐ป๐ฒ๐ฒ๐ฑ๐ฒ๐ฑ ๐๐ผ ๐ฟ๐ฒ๐บ๐ผ๐๐ฒ ๐ฎ๐ฑ๐บ๐ถ๐ป.",
notAllowed: "โ | ๐ฌ๐ผ๐ ๐ฎ๐ฟ๐ฒ ๐ป๐ผ๐ ๐ฎ๐น๐น๐ผ๐๐ฒ๐ฑ ๐๐ผ ๐๐๐ฒ ๐๐ต๐ถ๐!"
}
},
onStart: async function ({ message, args, event, usersData, getLang }) {
const senderID = event.senderID;
if (args[0] === "list" || args[0] === "-l") {
if (config.adminBot.length === 0)
return message.reply(getLang("noAdmin"));
const adminList = await Promise.all(
config.adminBot.map(async uid => {
const name = await usersData.getName(uid);
return `โข ${name} (${uid})`;
})
);
return message.reply(getLang("listAdmin", adminList.join("\n")));
}
if (["add", "-a", "remove", "-r"].includes(args[0])) {
if (!config.adminBot.includes(senderID))
return message.reply(getLang("notAllowed"));
}
if (args[0] === "add" || args[0] === "-a") {
let uids = [];
if (Object.keys(event.mentions).length)
uids = Object.keys(event.mentions);
else if (event.type === "message_reply")
uids = [event.messageReply.senderID];
else
uids = args.filter(a => !isNaN(a));
if (!uids.length)
return message.reply(getLang("missingIdAdd"));
const newAdmins = [];
const alreadyAdmins = [];
for (const uid of uids) {
if (config.adminBot.includes(uid))
alreadyAdmins.push(uid);
else
newAdmins.push(uid);
}
config.adminBot.push(...newAdmins);
writeFileSync(global.client.dirConfig, JSON.stringify(config, null, 2));
const newNames = await Promise.all(newAdmins.map(uid => usersData.getName(uid)));
const oldNames = await Promise.all(alreadyAdmins.map(uid => usersData.getName(uid)));
return message.reply(
(newNames.length ? getLang("added", newNames.length, newNames.map(n => `โข ${n}`).join("\n")) : "") +
(alreadyAdmins.length ? "\n" + getLang("alreadyAdmin", alreadyAdmins.length, oldNames.map(n => `โข ${n}`).join("\n")) : "")
);
}
if (args[0] === "remove" || args[0] === "-r") {
let uids = [];
if (Object.keys(event.mentions).length)
uids = Object.keys(event.mentions);
else if (event.type === "message_reply")
uids = [event.messageReply.senderID];
else
uids = args.filter(a => !isNaN(a));
if (!uids.length)
return message.reply(getLang("missingIdRemove"));
const removed = [];
const notAdmins = [];
for (const uid of uids) {
if (config.adminBot.includes(uid)) {
removed.push(uid);
config.adminBot.splice(config.adminBot.indexOf(uid), 1);
} else {
notAdmins.push(uid);
}
}
writeFileSync(global.client.dirConfig, JSON.stringify(config, null, 2));
const removedNames = await Promise.all(removed.map(uid => usersData.getName(uid)));
const notNames = await Promise.all(notAdmins.map(uid => usersData.getName(uid)));
return message.reply(
(removed.length ? getLang("removed", removed.length, removedNames.map(n => `โข ${n}`).join("\n")) : "") +
(notAdmins.length ? "\n" + getLang("notAdmin", notAdmins.length, notNames.map(n => `โข ${n}`).join("\n")) : "")
);
}
return message.reply("โ ๏ธ | ๐จ๐๐ฒ: ๐น๐ถ๐๐ / ๐ฎ๐ฑ๐ฑ / ๐ฟ๐ฒ๐บ๐ผ๐๐ฒ");
}
};