-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstickcmd.js
88 lines (62 loc) · 2.12 KB
/
stickcmd.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
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
88
const {zokou }= require ('../framework/zokou') ;
const {addstickcmd, deleteCmd, getCmdById, inStickCmd , getAllStickCmds} = require('../bdd/stickcmd') ;
zokou(
{
nomCom : 'setcmd',
categorie : 'stickcmd'
}, async (dest,zk,commandeOptions) => {
const {ms , arg, repondre,superUser , msgRepondu} = commandeOptions;
if (!superUser) { repondre('you can\'t use this command') ; return} ;
if(msgRepondu && msgRepondu.stickerMessage ) {
if(!arg || !arg[0]) { repondre('put the name of the command') ; return} ;
await addstickcmd(arg[0].toLowerCase() , msgRepondu.stickerMessage.url ) ;
repondre('Stick cmd save successfully')
} else {
repondre('mention a sticker')
}
}) ;
zokou(
{
nomCom: 'delcmd',
categorie: 'stickcmd'
},
async (dest, zk, commandeOptions) => {
const { ms, arg, repondre, superUser } = commandeOptions;
if (!superUser) {
repondre('only Mods can use this command');
return;
}
if (!arg || !arg[0]) {
repondre('put the name of the command that you want to delete');
return;
}
const cmdToDelete = arg[0];
try {
await deleteCmd(cmdToDelete.toLowerCase());
repondre(`the commande ${cmdToDelete} is deleted successfully.`);
} catch {
repondre(`the command ${cmdToDelete} don't existe`);
}
}
);
zokou(
{
nomCom: 'allcmd',
categorie: 'stickcmd'
},
async (dest, zk, commandeOptions) => {
const { repondre, superUser } = commandeOptions;
if (!superUser) {
repondre('only Mods can use this command');
return;
}
const allCmds = await getAllStickCmds();
if (allCmds.length > 0) {
const cmdList = allCmds.map(cmd => cmd.cmd).join(', ');
repondre(`*List of all stickcmd :*
${cmdList}`);
} else {
repondre('No stickcmd save');
}
}
);