forked from elrebelde21/LoliBot-MD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrupo-simulate.js
65 lines (55 loc) · 1.42 KB
/
grupo-simulate.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
let handler = async (m, { conn, usedPrefix, command, args: [event], text }) => {
let chat = global.db.data.chats[m.chat]
if (!chat.welcome) throw `⚠️ Para usar este comando debe actvar las Bienvenidas con *${usedPrefix}on* welcome`
let te = `
┌─⊷ *EVENTOS*
▢ welcome
▢ bye
▢ promote
▢ demote
└───────────
📌 Ejemplo :
*${usedPrefix + command}* welcome @user`
if (!event) return await m.reply(te)
let mentions = text.replace(event, '').trimStart()
let who = mentions ? conn.parseMention(mentions) : []
let part = who.length ? who : [m.sender]
let act = false
m.reply(`✅ Simulando ${event}...`)
switch (event.toLowerCase()) {
case 'add':
case 'bienvenida':
case 'invite':
case 'welcome':
act = 'add'
break
case 'bye':
case 'despedida':
case 'leave':
case 'remove':
act = 'remove'
break
case 'promote':
case 'promover':
act = 'promote'
break
case 'demote':
case 'degradar':
act = 'demote'
break
default:
throw te
}
if (act) return conn.participantsUpdate({
id: m.chat,
participants: part,
action: act
})
}
handler.help = ['simulate <event> @user']
handler.tags = ['group']
handler.command = ['simular', 'simulate']
handler.admin = true
handler.group = true
handler.register = true
export default handler