forked from juma-tec/MALIK-MD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch-deact.js
113 lines (111 loc) · 5.43 KB
/
switch-deact.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 : Secktor-Md
* @author : SamPandey001 <https://github.com/SamPandey001>
* @description : Secktor,A Multi-functional whatsapp bot.
* @version 0.0.6
**/
const { sck,sck1,cmd, getAdmin, tlang, prefix } = require('../lib')
const Config = require('../config')
//---------------------------------------------------------------------------
cmd({
pattern: "deact",
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 feature in 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: "false" })
.save()
return citel.reply(' Antilink disabled Successfully')
} else {
if (checkgroup.antilink == "false") return citel.reply("Antilink was alredy disabled.")
await sck.updateOne({ id: citel.chat }, { antilink: "false" })
citel.reply('disabled 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: "false" })
.save()
return citel.reply(' Economy disabled Successfully')
} else {
if (checkgroup.economy == "false") return citel.reply("Economy was alredy disabled.")
await sck.updateOne({ id: citel.chat }, { economy: "false" })
citel.reply('disabled Economy in current chat.')
return
}
}
break
case 'events':
{
let checkgroup = await sck.findOne({ id: citel.chat })
if (!checkgroup) {
await new sck({ id: citel.chat, events: "false" })
.save()
return citel.reply("Successfully disabled *Events*")
} else {
if (checkgroup.events == "false") return citel.reply("*Events* are already disabled")
await sck.updateOne({ id: citel.chat }, { events: "false" })
return citel.reply("Successfully disabled *Events*")
}
}
break
case 'cardgame':
{
let checkgroup = sck.findOne({ id: citel.chat })
if (!checkgroup) {
await new sck({ id: citel.chat, cardgame: "deactive" })
.save()
return citel.reply("Successfully disabled *Card Game*")
} else {
if (checkgroup.cardgame == "deactive") return citel.reply("*Card Game* was already disabled")
await sck.updateOne({ id: citel.chat }, { cardgame: "deactive" })
return citel.reply("Successfully disabled *Card Game.*")
}
}
break
case 'nsfw':
{
let checkgroup = await sck.findOne({ id: citel.chat })
if (!checkgroup) {
await new sck({ id: citel.chat, nsfw: "false" })
.save()
return citel.reply("Successfully disabled *NSFW*")
} else {
if (checkgroup.nsfw == "false") return citel.reply("*NSFW* is already disabled")
await sck.updateOne({ id: citel.chat }, { nsfw: "false" })
citel.reply("Successfully disabled *NSFW*")
return
}
}
break
default:
{
citel.reply("Please provide me term like.\n1-events\n2-antilink\n3-nsfw\n4-cardgame")
}
}
}
)