-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
eventss,js
50 lines (43 loc) · 2.02 KB
/
eventss,js
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
/* # Exclusively from danuma project
# Do not use this fore any commercial thing
# If you abuse thais bot we wil kick you from bot
# Do not edit (Respect to the Devaoloper)
# All rights reserved ©Lasiya @lasiya99X t.me/lasiya99X
# Get more about devaoloper https://lasiya.ml
*/
// Komutları burada tutacağız.
var config = require('./config');
var Commands = [];
function addCommand(info, func) {
// Basit bir fonksiyon, komut eklemek için.
var types = ['photo', 'image', 'text', 'message'];
var infos = {
fromMe: info['fromMe'] === undefined ? true : info['fromMe'], // Or Sudo
onlyGroup: info['onlyGroup'] === undefined ? false : info['onlyGroup'],
onlyPinned: info['onlyPinned'] === undefined ? false : info['onlyPinned'],
onlyPm: info['onlyPm'] === undefined ? false : info['onlyPm'],
deleteCommand: info['deleteCommand'] === undefined ? true : info['deleteCommand'],
desc: info['desc'] === undefined ? '' : info['desc'],
usage: info['usage'] === undefined ? '' : info['usage'],
dontAddCommandList: info['dontAddCommandList'] === undefined ? false : info['dontAddCommandList'],
warn: info['warn'] === undefined ? '' : info['warn'],
function: func
};
if (info['on'] === undefined && info['pattern'] === undefined) {
infos.on = 'message';
infos.fromMe = false;
} else if (info['on'] !== undefined && types.includes(info['on'])) {
infos.on = info['on'];
if (info['pattern'] !== undefined) {
infos.pattern = new RegExp((info['handler'] === undefined || info['handler'] === true ? config.HANDLERS : '') + info.pattern, (info['flags'] !== undefined ? info['flags'] : ''));
}
} else {
infos.pattern = new RegExp((info['handler'] === undefined || info['handler'] === true ? config.HANDLERS : '') + info.pattern, (info['flags'] !== undefined ? info['flags'] : ''));
}
Commands.push(infos);
return infos;
}
module.exports = {
addCommand: addCommand,
commands: Commands
}