File size: 2,296 Bytes
9d1558c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | const fs = require("fs-extra");
const { config } = global.GoatBot;
const { client } = global;
module.exports = {
config: {
name: "adminonly",
aliases: ["adonly", "onlyad", "onlyadmin"],
version: "1.3",
author: "NTKhang",
countDown: 5,
role: 2,
shortDescription: {
vi: "bật/tắt chỉ admin sử dụng bot",
en: "turn on/off only admin can use bot"
},
longDescription: {
vi: "bật/tắt chế độ chỉ admin mới có thể sử dụng bot",
en: "turn on/off only admin can use bot"
},
category: "owner",
guide: {
vi: " {pn} [on | off]: bật/tắt chế độ chỉ admin mới có thể sử dụng bot"
+ "\n {pn} noti [on | off]: bật/tắt thông báo khi người dùng không phải là admin sử dụng bot",
en: " {pn} [on | off]: turn on/off the mode only admin can use bot"
+ "\n {pn} noti [on | off]: turn on/off the notification when user is not admin use bot"
}
},
langs: {
vi: {
turnedOn: "Đã bật chế độ chỉ admin mới có thể sử dụng bot",
turnedOff: "Đã tắt chế độ chỉ admin mới có thể sử dụng bot",
turnedOnNoti: "Đã bật thông báo khi người dùng không phải là admin sử dụng bot",
turnedOffNoti: "Đã tắt thông báo khi người dùng không phải là admin sử dụng bot"
},
en: {
turnedOn: "Turned on the mode only admin can use bot",
turnedOff: "Turned off the mode only admin can use bot",
turnedOnNoti: "Turned on the notification when user is not admin use bot",
turnedOffNoti: "Turned off the notification when user is not admin use bot"
}
},
onStart: function ({ args, message, getLang }) {
let isSetNoti = false;
let value;
let indexGetVal = 0;
if (args[0] == "noti") {
isSetNoti = true;
indexGetVal = 1;
}
if (args[indexGetVal] == "on")
value = true;
else if (args[indexGetVal] == "off")
value = false;
else
return message.SyntaxError();
if (isSetNoti) {
config.adminOnly.hideNotiMessage = !value;
message.reply(getLang(value ? "turnedOnNoti" : "turnedOffNoti"));
}
else {
config.adminOnly.enable = value;
message.reply(getLang(value ? "turnedOn" : "turnedOff"));
}
fs.writeFileSync(client.dirConfig, JSON.stringify(config, null, 2));
}
}; |