forked from Maduradilshan/Dilshann-MD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
switch-deact.js
132 lines (119 loc) · 7.63 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/**
//══════════════════════════════════════════════════════════════════════════════════════════════════════//
WHATSAPP BOT-MD BETA
V:1.0.1
██╗ ██╗ █████╗ ██╗██╗██████╗ █████╗ ███╗ ███╗██████╗
██║ ██║██╔══██╗ ██║██║██╔══██╗██╔══██╗ ████╗ ████║██╔══██╗
██║ ██║███████║ ██║██║██████╔╝███████║ █████╗██╔████╔██║██║ ██║
╚██╗ ██╔╝██╔══██║██ ██║██║██╔══██╗██╔══██║ ╚════╝██║╚██╔╝██║██║ ██║
╚████╔╝ ██║ ██║╚█████╔╝██║██║ ██║██║ ██║ ██║ ╚═╝ ██║██████╔╝
╚═══╝ ╚═╝ ╚═╝ ╚════╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚═════╝
//══════════════════════════════════════════════════════════════════════════════════════════════════════//
CURRENTLY RUNNING ON BETA VERSION!!
*
* @project_name : Vajira-Md
* @author : Vajira Tech Info
* @youtube : https://youtube.com/@gamingewingyt6216
* @description : Vajira-Md ,A Multi-functional whatsapp user bot.
* @version 1.2.2
*
* Licensed under the GPL-3.0 License;
*
* ┌┤Created By Vajira Tech Info.
* © 2023 Vajira-Md ✭ ⛥.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
**/
const { groupdb,smd, getAdmin, tlang, prefix } = require('../lib')
const Config = require('../config')
let sck = groupdb;
//---------------------------------------------------------------------------
smd({
pattern: "deact",
alias : ['deactive','deactivate'],
desc: "Switches for varios works.",
category: "group",
react: "⚙️",
filename: __filename
},
async(Suhail, msg, text,{ isCreator }) => {
//-----------------------------------------
if (!msg.isGroup) return msg.reply(tlang().group);
const groupAdmins = await getAdmin(Suhail.bot, msg)
const botNumber = await Suhail.bot.decodeJid(msg.user)
const isBotAdmins = msg.isGroup ? groupAdmins.includes(botNumber) : false;
const isAdmins = msg.isGroup ? groupAdmins.includes(msg.sender) : false;
//-----------------------------------------
if (!msg.isGroup) return msg.reply("This feature in only for Group.")
if (!text) return msg.reply(`❌ Please provide me term like like\n1-events\n2-antilink\n3-nsfw\n4-economy`)
if (isCreator){console.log("this is a Bot Number in Deact Functions")}
else if (!isAdmins) return msg.reply("❌ This command is only for admin")
switch (text.split(" ")[0]) {
case 'antilink':
{
let checkgroup = await sck.findOne({ id: msg.chat })
if (!checkgroup) {
await sck.new({ id: msg.chat, antilink: "false" })
return msg.reply(' Antilink disabled Successfully')
} else {
if (checkgroup.antilink == "false") return msg.reply("Antilink was alredy disabled.")
await sck.updateOne({ id: msg.chat }, { antilink: "false" })
msg.reply('disabled antilink in current chat.')
return
}
}
break
case 'economy':
{
let checkgroup = await sck.findOne({ id: msg.chat })
if (!checkgroup) {
await sck.new({ id: msg.chat, economy: "false" })
return msg.reply(' Economy disabled Successfully')
} else {
if (checkgroup.economy == "false") return msg.reply("Economy was alredy disabled.")
await sck.updateOne({ id: msg.chat }, { economy: "false" })
msg.reply('disabled Economy in current chat.')
return
}
}
break
case 'events':
{
let checkgroup = await sck.findOne({ id: msg.chat })
if (!checkgroup) {
await sck.new({ id: msg.chat, events: "false" })
return msg.reply("Successfully disabled *Events*")
} else {
if (checkgroup.events == "false") return msg.reply("*Events* are already disabled")
await sck.updateOne({ id: msg.chat }, { events: "false" })
return msg.reply("Successfully disabled *Events*")
}
}
break
case 'nsfw':
{
let checkgroup = await sck.findOne({ id: msg.chat })
if (!checkgroup) {
await sck.new({ id: msg.chat, nsfw: "false" })
return msg.reply("Successfully disabled *NSFW*")
} else {
if (checkgroup.nsfw == "false") return msg.reply("*NSFW* is already disabled")
await sck.updateOne({ id: msg.chat }, { nsfw: "false" })
msg.reply("Successfully disabled *NSFW*")
return
}
}
break
default:
{
msg.reply("Please provide me term like.\n1-events\n2-antilink\n3-nsfw\n4-economy")
}
}
}
)