-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp2.js
More file actions
87 lines (73 loc) · 3.92 KB
/
help2.js
File metadata and controls
87 lines (73 loc) · 3.92 KB
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
84
85
86
87
/**
* @author Zeeshan Altaf
* @warn Do not edit code or edit credits
* @Dont Change This Credits Otherwisw Your Bot Lol
*/
module.exports.config = {
name: "help2",
version: "1.0.2",
hasPermssion: 0,
credits: "Zeeshan Altaf",
description: "Dont Change This Credits Otherwise Your Bot Lol",
commandCategory: "system",
usages: "[Ten module]",
cooldowns: 1,
envConfig: {
autoUnsend: true,
delayUnsend: 300
}
};
module.exports.languages = {
"en": {
"moduleInfo": "「 %1 」\n%2\n\n❯ Usage: %3\n❯ Category: %4\n❯ Waiting time: %5 seconds(s)\n❯ Permission: %6\n\n» Module code by %7 «",
"helpList": '[ There are %1 commands on this bot, Use: "%2help nameCommand" to know how to use! ]',
"user": "User",
"adminGroup": "Admin group",
"adminBot": "Admin bot"
}
};
module.exports.handleEvent = function ({ api, event, getText }) {
const { commands } = global.client;
const { threadID, messageID, body } = event;
if (!body || typeof body == "undefined" || body.indexOf("help") != 0) return;
const splitBody = body.slice(body.indexOf("help")).trim().split(/\s+/);
if (splitBody.length == 1 || !commands.has(splitBody[1].toLowerCase())) return;
const threadSetting = global.data.threadData.get(parseInt(threadID)) || {};
const command = commands.get(splitBody[1].toLowerCase());
const prefix = (threadSetting.hasOwnProperty("PREFIX")) ? threadSetting.PREFIX : global.config.PREFIX;
return api.sendMessage(getText("moduleInfo", command.config.name, command.config.description, `${prefix}${command.config.name} ${(command.config.usages) ? command.config.usages : ""}`, command.config.commandCategory, command.config.cooldowns, ((command.config.hasPermssion == 0) ? getText("user") : (command.config.hasPermssion == 1) ? getText("adminGroup") : getText("adminBot")), command.config.credits), threadID, messageID);
}
module.exports. run = function({ api, event, args, getText }) {
const { commands } = global.client;
const { threadID, messageID } = event;
const command = commands.get((args[0] || "").toLowerCase());
const threadSetting = global.data.threadData.get(parseInt(threadID)) || {};
const { autoUnsend, delayUnsend } = global.configModule[this.config.name];
const prefix = (threadSetting.hasOwnProperty("PREFIX")) ? threadSetting.PREFIX : global.config.PREFIX;
if (!command) {
const arrayInfo = [];
const page = parseInt(args[0]) || 1;
const numberOfOnePage = 9999;
//*số thứ tự 1 2 3.....cú pháp ${++i}*//
let i = 0;
let msg = "";
for (var [name, value] of (commands)) {
name += ``;
arrayInfo.push(name);
}
arrayInfo.sort((a, b) => a.data - b.data);
const startSlice = numberOfOnePage*page - numberOfOnePage;
i = startSlice;
const returnArray = arrayInfo.slice(startSlice, startSlice + numberOfOnePage);
for (let item of returnArray) msg += `🌸 ${++i} ${prefix}${item} \n`;
const siu = `TOTAL COMMAND LIST ❤️🍫`;
const text = `Page\n (${page}/${Math.ceil(arrayInfo.length/numberOfOnePage)})\n\n Or command dekhny han to menu type kr bero 😑 *★᭄𝗖𝗿𝗲𝗱𝗶𝘁'𝘀 ཫ༄𒁍≛⃝𝝛𝝣𝝚𝘚𝝜𝝠N𝝠ɭƬ𝝠F`;
return api.sendMessage(siu + "\n\n" + msg + text, threadID, async (error, info) => {
if (autoUnsend) {
await new Promise(resolve => setTimeout(resolve, delayUnsend * 1000));
return api.unsendMessage(info.messageID);
} else return;
}, event.messageID);
}
return api.sendMessage(getText("moduleInfo", command.config.name, command.config.description, `${prefix}${command.config.name} ${(command.config.usages) ? command.config.usages : ""}`, command.config.commandCategory, command.config.cooldowns, ((command.config.hasPermssion == 0) ? getText("user") : (command.config.hasPermssion == 1) ? getText("adminGroup") : getText("adminBot")), command.config.credits), threadID, messageID);
};