forked from A-d-i-t-h-y-a-n/hermit-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathantifake.js
64 lines (56 loc) · 1.83 KB
/
antifake.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
const {
Function,
setAntiFake,
antiFakeList,
prefix
} = require('../lib/')
const {
getFake
} = require('../lib/database/antifake')
Function({
pattern: 'antifake ?(.*)',
fromMe: true,
onlyGroup: true,
desc: 'Set antifake',
type: 'group'
}, async (message, match) => {
const groupMetadata = await message.client.groupMetadata(message.chat)
const isAntiFake = await getFake(message.jid)
let buttons = [
{
buttonId: prefix + 'antifake on',
buttonText: { displayText: 'ON' },
type: 1
},
{
buttonId: prefix + 'antifake off',
buttonText: { displayText: 'OFF' },
type: 1
},
{
buttonId: prefix + 'antifake list',
buttonText: { displayText: 'LIST' },
type: 1
}
]
let isAntiFakeEnabled = isAntiFake && isAntiFake.enabled || false
const buttonMessage = {
text: 'Antifake Manager',
footer: `Group Name: ${groupMetadata.subject}\nAntiFake Status: ${isAntiFakeEnabled ? 'Enabled' : 'Disabled'}`,
buttons: buttons,
headerType: 1
}
if (!match) return await message.client.sendMessage(message.chat, buttonMessage)
if (match === 'list') {
if (!isAntiFake) {
return await message.reply("_You haven't set the Antifake yet._\n__To set:__ ```.antifake 1,44,972...```")
}
return await message.reply(await antiFakeList(message.jid))
}
if (match === 'on' || match === 'off') {
await setAntiFake(message.jid, match)
return await message.reply(`_Antifake ${match === 'on' ? 'Activated' : 'Deactivated'}_`)
}
await setAntiFake(message.jid, match)
return await message.reply('_Antifake Updated_')
})