-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalive.js
94 lines (64 loc) · 2.2 KB
/
alive.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
89
90
91
92
93
94
const { zokou } = require('../framework/zokou');
const {addOrUpdateDataInAlive , getDataFromAlive} = require('../bdd/alive')
const moment = require("moment-timezone");
const s = require(__dirname + "/../set");
zokou(
{
nomCom : 'alive',
categorie : 'General'
},async (dest,zk,commandeOptions) => {
const {ms , arg, repondre,superUser} = commandeOptions;
const data = await getDataFromAlive();
if (!arg || !arg[0] || arg.join('') === '') {
if(data) {
const {message , lien} = data;
var mode = "public";
if ((s.MODE).toLocaleLowerCase() != "yes") {
mode = "private";
}
moment.tz.setDefault('Etc/GMT');
// Créer une date et une heure en GMT
const temps = moment().format('HH:mm:ss');
const date = moment().format('DD/MM/YYYY');
const alivemsg = `
*Owner* : ${s.OWNER_NAME}
*Mode* : ${mode}
*Date* : ${date}
*Hours(GMT)* : ${temps}
${message}
*ANYWAY-MD-WABOT*`
if (lien.match(/\.(mp4|gif)$/i)) {
try {
zk.sendMessage(dest, { video: { url: lien }, caption: alivemsg }, { quoted: ms });
}
catch (e) {
console.log("🥵🥵 Menu erreur " + e);
repondre("🥵🥵 Menu erreur " + e);
}
}
// Checking for .jpeg or .png
else if (lien.match(/\.(jpeg|png|jpg)$/i)) {
try {
zk.sendMessage(dest, { image: { url: lien }, caption: alivemsg }, { quoted: ms });
}
catch (e) {
console.log("🥵🥵 Menu erreur " + e);
repondre("🥵🥵 Menu erreur " + e);
}
}
else {
repondre(alivemsg);
}
} else {
if(!superUser) { repondre("there is no alive for this bot") ; return};
await repondre("You have not yet saved your alive, to do this; enter after alive your message and your image or video link in this context: .alive message;lien");
repondre("don't do fake thinks :)")
}
} else {
if(!superUser) { repondre ("Only the owner can modify the alive") ; return};
const texte = arg.join(' ').split(';')[0];
const tlien = arg.join(' ').split(';')[1];
await addOrUpdateDataInAlive(texte , tlien)
repondre(' Holla🥴, *ANYWAY-MD BOT* is alive just like you gee. ')
}
});