File size: 2,763 Bytes
80ce16c | 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 74 75 76 77 78 79 80 81 82 83 | if (!global.client.busyList)
global.client.busyList = {};
module.exports = {
config: {
name: "busy",
version: "1.5",
author: "NTKhang",
countDown: 5,
role: 0,
shortDescription: {
vi: "bật chế độ không làm phiền",
en: "turn on do not disturb mode"
},
longDescription: {
vi: "bật chế độ không làm phiền, khi bạn được tag bot sẽ thông báo",
en: "turn on do not disturb mode, when you are tagged bot will notify"
},
category: "box chat",
guide: {
vi: " {pn} [để trống | <lý do>]: bật chế độ không làm phiền"
+ "\n {pn} off: tắt chế độ không làm phiền",
en: " {pn} [empty | <reason>]: turn on do not disturb mode"
+ "\n {pn} off: turn off do not disturb mode"
}
},
langs: {
vi: {
turnedOff: "✅ | Đã tắt chế độ không làm phiền",
turnedOn: "✅ | Đã bật chế độ không làm phiền",
turnedOnWithReason: "✅ | Đã bật chế độ không làm phiền với lý do: %1",
turnedOnWithoutReason: "✅ | Đã bật chế độ không làm phiền",
alreadyOn: "Hiện tại người dùng %1 đang bận",
alreadyOnWithReason: "Hiện tại người dùng %1 đang bận với lý do: %2"
},
en: {
turnedOff: "✅ | Do not disturb mode has been turned off",
turnedOn: "✅ | Do not disturb mode has been turned on",
turnedOnWithReason: "✅ | Do not disturb mode has been turned on with reason: %1",
turnedOnWithoutReason: "✅ | Do not disturb mode has been turned on",
alreadyOn: "User %1 is currently busy",
alreadyOnWithReason: "User %1 is currently busy with reason: %2"
}
},
onStart: async function ({ args, message, event, getLang, usersData }) {
const { senderID } = event;
if (args[0] == "off") {
const { data } = await usersData.get(senderID);
delete data.busy;
await usersData.set(senderID, data, "data");
return message.reply(getLang("turnedOff"));
}
const reason = args.join(" ") || "";
await usersData.set(senderID, reason, "data.busy");
return message.reply(
reason ?
getLang("turnedOnWithReason", reason) :
getLang("turnedOnWithoutReason")
);
},
onChat: async ({ event, message, getLang }) => {
const { mentions } = event;
if (!mentions || Object.keys(mentions).length == 0)
return;
const arrayMentions = Object.keys(mentions);
for (const userID of arrayMentions) {
const reasonBusy = global.db.allUserData.find(item => item.userID == userID)?.data.busy || false;
if (reasonBusy !== false) {
return message.reply(
reasonBusy ?
getLang("alreadyOnWithReason", mentions[userID].replace("@", ""), reasonBusy) :
getLang("alreadyOn", mentions[userID].replace("@", "")));
}
}
}
}; |