Skip to content

Commit

Permalink
Update enable.js
Browse files Browse the repository at this point in the history
  • Loading branch information
whiteshadowofficial authored Jan 19, 2024
1 parent 003f8d8 commit e8a8d75
Showing 1 changed file with 106 additions and 46 deletions.
152 changes: 106 additions & 46 deletions plugins/enable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,104 @@
let handler = async (m, { conn, usedPrefix, command, args, isOwner, isAdmin, isROwner }) => {
let isEnable = /true|enable|(turn)?on|1/i.test(command)
let chat =global.DATABASE.data.chats[m.chat]
let user = global.DATABASE.data.users[m.sender]
let bot = global.DATABASE.data.settings[conn.user.jid] || {}
let type = (args[0] || '').toLowerCase()
let isAll = false, isUser = false
switch (type) {
case 'welcome':
if (!m.isGroup) {
if (!isOwner) {
global.dfail('group', m, conn)
throw false
}
} else if (!isAdmin) {
global.dfail('admin', m, conn)
throw false
}
chat.welcome = isEnable
break
case 'delete':
if (m.isGroup) {
if (!(isAdmin || isOwner)) {
global.dfail('admin', m, conn)
throw false
}
}
chat.delete = isEnable
break
case 'nsfw':
if (m.isGroup) {
if (!(isAdmin || isOwner)) {
global.dfail('admin', m, conn)
throw false
}}
chat.nsfw = isEnable
break
case 'premnsfwchat':
if (m.isGroup) {
if (!isROwner) {
global.dfail('rowner', m, conn)
throw false
}}
chat.premnsfw = isEnable
break
case 'autoSticker':
if (m.isGroup) {
if (!(isAdmin || isOwner)) {
global.dfail('admin', m, conn)
throw false
}
}
chat.autoSticker = isEnable
break
case 'antispam':
if (m.isGroup) {
if (!(isAdmin || isOwner)) {
global.dfail('admin', m, conn)
throw false
}
}
chat.antiSpam = isEnable
break
case 'anticall':
isAll = true
if (!isOwner) {
global.dfail('rowner', m, conn)
throw false
}
chat.anticall = isEnable
break
case 'antidelete':
if (m.isGroup) {
if (!(isAdmin || isOwner)) {
global.dfail('admin', m, conn)
throw false
}
}
chat.delete = !isEnable
break
case 'public':
isAll = true
if (!isROwner) {
global.dfail('rowner', m, conn)
throw false
}
global.opts['self'] = !isEnable
break
case 'antilink':
if (m.isGroup) {
if (!(isAdmin || isOwner)) {
global.dfail('admin', m, conn)
throw false
}
}
chat.antiLink = isEnable
break
case 'restrict':
isAll = true
if (!isOwner) {
global.dfail('owner', m, conn)
throw false
}
bot.restrict = isEnable
Expand All @@ -19,31 +119,6 @@ let handler = async (m, { conn, usedPrefix, command, args, isOwner, isAdmin, isR
}
global.opts['autoread'] = isEnable
break
case 'pmblocker':
isAll = true
if (!isROwner) {
global.dfail('rowner', m, conn)
throw false
}
bot.pmblocker = isEnable
break
case 'autobio':
isAll = true
if (!isROwner) {
global.dfail('rowner', m, conn)
throw false
}
bot.autoBio = isEnable
break
case 'chatbot':
if (m.isGroup) {
if (!(isAdmin || isOwner)) {
global.dfail('admin', m, conn)
throw false
}
}
chat.chatbot = isEnable
break
case 'pconly':
case 'privateonly':
isAll = true
Expand Down Expand Up @@ -72,27 +147,12 @@ case 'autobio':
global.opts['swonly'] = isEnable
break
default:
if (!/[01]/.test(command)) return m.reply(`◈──『 *ADMIN*』───⳹
➬ welcome
➬ antilink
➬ nsfw
➬ autosticker
➬ antispam
➬ antitoxic
╰──────────⳹
◈──『 *USERS*』───⳹
➬ autolevelup
➬ chatbot
╰──────────⳹
◈──『 *OWNER*』───⳹
➬ onlydm
➬ grouponly
➬ autotype
➬ autobio
╰──────────⳹
*📌 Example :*
*${usedPrefix}on* welcome
*${usedPrefix}off* welcome`.trim())
if (!/[01]/.test(command)) return m.reply(`
List option: welcome | delete | public | antilink | antidelete | antitoxic | autolevelup | detect | document | whitelistmycontacts | restrict | nyimak | autoread | pconly | gconly | swonly
Contoh:
${usedPrefix}enable welcome
${usedPrefix}disable welcome
`.trim())
throw false
}
m.reply(`
Expand Down

0 comments on commit e8a8d75

Please sign in to comment.