forked from juma-tec/MALIK-MD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch-act.js
113 lines (111 loc) · 5.2 KB
/
switch-act.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
Copyright (C) 2022.
Licensed under the GPL-3.0 License;
You may not use this file except in compliance with the License.
It is supplied in the hope that it may be useful.
* @project_name : MALIK-MD
* @author : arkhan998 <https://github.com/arkhan998>
* @description : malik,A Multi-functional whatsapp bot.
* @version 0.0.6
**/
const { cmd,sck,sck1, getAdmin, tlang, prefix } = require('../lib')
const Config = require('../config')
//---------------------------------------------------------------------------
cmd({
pattern: "act",
desc: "Switches for varios works.",
category: "group",
filename: __filename,
},
async(Void, citel, text,{ isCreator }) => {
//-----------------------------------------
if (!citel.isGroup) return citel.reply(tlang().group);
const groupAdmins = await getAdmin(Void, citel)
const botNumber = await Void.decodeJid(Void.user.id)
const isBotAdmins = citel.isGroup ? groupAdmins.includes(botNumber) : false;
const isAdmins = citel.isGroup ? groupAdmins.includes(citel.sender) : false;
//-----------------------------------------
if (!citel.isGroup) return citel.reply("This command is only for group")
if (!text) return citel.reply(`⚡️ Please provide me term like like\n1-events\n2-antilink\n3-nsfw\n4-cardgame\n5-bot`)
if (!isAdmins) return citel.reply("⚡️ This command is only for admin")
switch (text.split(" ")[0]) {
case 'antilink':
{
let checkgroup = await sck.findOne({ id: citel.chat })
if (!checkgroup) {
await new sck({ id: citel.chat, antilink: "true" })
.save()
return citel.reply(' Antilink Enabled Successfully')
} else {
if (checkgroup.antilink == "true") return citel.reply("Antilink was alredy enabled here.")
await sck.updateOne({ id: citel.chat }, { antilink: "true" })
citel.reply('Enabled antilink in current chat.')
return
}
}
break
case 'economy':
{
let checkgroup = await sck.findOne({ id: citel.chat })
if (!checkgroup) {
await new sck({ id: citel.chat, economy: "true" })
.save()
return citel.reply(' Economy Enabled Successfully')
} else {
if (checkgroup.economy == "true") return citel.reply("Economy was alredy enabled.")
await sck.updateOne({ id: citel.chat }, { economy: "true" })
citel.reply('Economy enabled in current chat.')
return
}
}
break
case 'events':
{
let checkgroup = await sck.findOne({ id: citel.chat })
if (!checkgroup) {
await new sck({ id: citel.chat, events: "true" })
.save()
return citel.reply("Successfully Enabled *Events*")
} else {
if (checkgroup.events == "true") return citel.reply("*Events* are already enabled")
await sck.updateOne({ id: citel.chat }, { events: "true" })
return citel.reply("Successfully Enabled *Events*")
}
}
break
case 'cardgame':
{
let checkgroup = sck.findOne({ id: citel.chat })
if (!checkgroup) {
await new sck({ id: citel.chat, cardgame: "active" })
.save()
return citel.reply("Successfully Enabled *Card Game*")
} else {
if (checkgroup.cardgame == "active") return citel.reply("*Card Game* was already enabled")
await sck.updateOne({ id: citel.chat }, { cardgame: "active" })
return citel.reply("Successfully Enabled *Card Game.*")
}
}
break
case 'nsfw':
{
let checkgroup = await sck.findOne({ id: citel.chat })
if (!checkgroup) {
await new sck({ id: citel.chat, nsfw: "true" })
.save()
return citel.reply("Successfully Enabled *NSFW*")
} else {
if (checkgroup.nsfw == "true") return citel.reply("*NSFW* is already enabled")
await sck.updateOne({ id: citel.chat }, { nsfw: "true" })
citel.reply("Successfully Enabled *NSFW*")
return
}
}
break
default:
{
citel.reply("Please provide me with terms like.\n1-events\n2-antilink\n3-nsfw\n4-economy")
}
}
}
)