diff --git a/lib/banned.json b/lib/banned.json index 35569b2..fe51488 100644 --- a/lib/banned.json +++ b/lib/banned.json @@ -1 +1 @@ -["6285748114275@c.us","6289693505920@c.us","6285729822139@c.us","62859196454646@c.us","19197296113@c.us","6285606399378@c.us","6285710191042@c.us","6285294081010@c.us","6289635884142@c.us","6285264851203@c.us","6285333078663@c.us","6285886383848@c.us","6285643114552@c.us","6282114632786@c.us","6281515512617@c.us","6285933683818@c.us","6281212449972@c.us","6281534030650@c.us","6285340288527@c.us","6283843527740@c.us","6281228611322@c.us","6287788647254@c.us","6281931134258@c.us","6288236295241@c.us","6283891624169@c.us","6283179944034@c.us","62895384379672@c.us","6285726027824@c.us","628889416728@c.us","6288247989553@c.us","6287813583718@c.us","62895422248741@c.us","6282323680818@c.us","6282399364490@c.us","6289516301783@c.us","628978255369@c.us","6281383153956@c.us","6285767085602@c.us","6283142405384@c.us","6289519971618@c.us","6282211404381@c.us","6281351960512@c.us","628122326853@c.us","6281411140168@c.us","6285724796915@c.us","628872403387@c.us","6282283276951@c.us","6282244908391@c.us","5514996858492@c.us","6282178150792@c.us","6282362310866@c.us"] \ No newline at end of file +[] diff --git a/msgHandler.js b/msgHandler.js index 6471ce7..fc043ad 100644 --- a/msgHandler.js +++ b/msgHandler.js @@ -6,12 +6,10 @@ const get = require('got') const color = require('./lib/color') const { liriklagu, quotemaker, wall } = require('./lib/functions') const { help, info, } = require('./lib/help') -const quotedd = require('./lib/quote') const msgFilter = require('./lib/msgFilter') const akaneko = require('akaneko'); const fetch = require('node-fetch'); const bent = require('bent') -const invitegrp = '919744375687-1599238855@g.us' 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' const errorurl2 = 'https://steamuserimages-a.akamaihd.net/ugc/954087817129084207/5B7E46EE484181A676C02DFCAD48ECB1C74BC423/?imw=512&&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false' @@ -46,8 +44,8 @@ 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('919744375687-1599187760@g.us') - const isbotadmin = sender.id.includes(botadmins) + const owner = '919744375687' // eg 9190xxxxxxxx@ + const isowner = sender.id+'@c.us' == owner msgFilter.addFilter(from) @@ -93,9 +91,9 @@ module.exports = msgHandler = async (client, message) => { return console.log(err) } var postData = { - api_key: 'LBtGgqqQpp663mo1nIEADPcv1AddeLtb', + api_key: 'your_giphy_api_key', // https://devlopers.giphy.com file: { - value: fs.createReadStream(filename), + value: fs.createReadStream(filename), options: { filename: filename, contentType: 'image/gif' @@ -155,7 +153,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) { @@ -165,7 +163,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)) @@ -209,7 +207,7 @@ 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) @@ -217,7 +215,7 @@ module.exports = msgHandler = async (client, message) => { 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)) @@ -265,7 +263,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 @@ -278,7 +275,6 @@ module.exports = msgHandler = async (client, message) => { }).catch(error => { client.reply(from, 'An error occured 💔️', message.id) }) - } break case 'sauce': if (isMedia) { diff --git a/package.json b/package.json index 6664401..f094684 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "whatsapp-botto-re", "version": "3.0.0", "description": "Anime Bot", - "main": "kntl.js", + "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js"