Download scripts/cmds/busy.js from bot512/5121512: direct link, hf CLI and curl.
- Browser
- Download file 2.76 kB
-
https://huggingface.co/spaces/bot512/5121512/resolve/main/scripts/cmds/busy.js
- Command line
-
hf download hf://spaces/bot512/5121512/scripts/cmds/busy.js
-
curl -L -o busy.js https://huggingface.co/spaces/bot512/5121512/resolve/main/scripts/cmds/busy.js
2.76 kB
| 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("@", ""))); | |
| } | |
| } | |
| } | |
| }; |