Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
AlenVelocity authored Sep 17, 2020
1 parent ca7812e commit 18db5be
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions msgHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const { help, info, } = require('./lib/help')
const quotedd = require('./lib/quote')
const msgFilter = require('./lib/msgFilter')
const akaneko = require('akaneko');
const invitegrp = '[email protected]'
const ban = JSON.parse(fs.readFileSync('./lib/banned.json'))
const errorurl = 'https://steamuserimages-a.akamaihd.net/ugc/954087817129084207/5B7E46EE484181A676C02DFCAD48ECB1C74BC423/?imw=512&&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false'

Expand Down Expand Up @@ -43,8 +42,7 @@ module.exports = msgHandler = async (client, message) => {
const isGroupAdmins = isGroupMsg ? groupAdmins.includes(sender.id) : false
const isBotGroupAdmins = isGroupMsg ? groupAdmins.includes(botNumber + '@c.us') : false
const isBanned = ban.includes(chatId)
const botadmins = await client.getGroupAdmins('[email protected]')
const isbotadmin = author.includes(botadmins)
const isowner = sender.id === '[email protected]'

msgFilter.addFilter(from)

Expand Down Expand Up @@ -152,7 +150,7 @@ module.exports = msgHandler = async (client, message) => {
}
break
case 'bc':
if(!isbotadmin) return client.reply(from, 'Only Bot admins!', message.id)
if(!isowner) return client.reply(from, 'Only Bot admins!', message.id)
let msg = body.slice(4)
const chatz = await client.getAllChatIds()
for (let ids of chatz) {
Expand All @@ -162,7 +160,7 @@ module.exports = msgHandler = async (client, message) => {
client.reply(from, 'Broadcast Success!', message.id)
break
case 'ban':
if(!isbotadmin) return client.reply(from, 'Only Bot admins can use this CMD!', message.id)
if(!isowner) return client.reply(from, 'Only Bot admins can use this CMD!', message.id)
for (let i = 0; i < mentionedJidList.length; i++) {
ban.push(mentionedJidList[i])
fs.writeFileSync('./lib/banned.json', JSON.stringify(ban))
Expand Down Expand Up @@ -206,15 +204,15 @@ module.exports = msgHandler = async (client, message) => {
client.reply(from, 'Done!', message.id)
break
case 'clearall':
if (!isbotadmin) return client.reply(from, 'Owner only', message.id)
if (!isowner) return client.reply(from, 'Owner only', message.id)
const allChatz = await client.getAllChats()
for (let dchat of allChatz) {
await client.deleteChat(dchat.id)
}
client.reply(from, 'Done', message.id)
break
case 'unban':
if(!isbotadmin) return client.reply(from, 'Only bot admins can use this CMD', message.id)
if(!isowner) return client.reply(from, 'Only bot admins can use this CMD', message.id)
let inx = ban.indexOf(mentionedJidList[0])
ban.splice(inx, 1)
fs.writeFileSync('./lib/banned.json', JSON.stringify(ban))
Expand Down Expand Up @@ -256,7 +254,6 @@ module.exports = msgHandler = async (client, message) => {
await client.sendTextWithMentions(from, `Demoted @${mentionedJidList[0].replace('@c.us', '')}.`)
break
case 'join':
if (chat.id == invitegrp) {
if (args.length == 0) return client.reply(from, 'Wrong Format', message.id)
const link = body.slice(6)
const minMem = 30
Expand All @@ -269,7 +266,6 @@ module.exports = msgHandler = async (client, message) => {
}).catch(error => {
client.reply(from, 'An error occured 💔️', message.id)
})
}
break
case 'sauce':
if (isMedia) {
Expand Down

0 comments on commit 18db5be

Please sign in to comment.