Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
2c8ba06
release
neoxr Oct 21, 2022
29a68ff
release
neoxr Oct 21, 2022
a4b6173
release
neoxr Oct 21, 2022
3c2a6a4
+ example creds.json
neoxr Oct 21, 2022
2289215
update baileys version
neoxr Oct 21, 2022
fc3f4a1
update readme
neoxr Oct 22, 2022
45ef57f
update readme
neoxr Oct 22, 2022
98b930c
update
neoxr Oct 24, 2022
1b15c0c
automatic data check and deletion every 1 minute
neoxr Oct 24, 2022
f14e2fd
automatic data check and deletion every 1 minute
neoxr Oct 24, 2022
8e45491
downgrade baileys
neoxr Oct 25, 2022
6799050
update
neoxr Oct 25, 2022
9d40fa3
little bit
neoxr Oct 26, 2022
b469015
fix tomp3
neoxr Oct 26, 2022
f308924
+ set image cover
neoxr Oct 26, 2022
156b896
+ set image cover
neoxr Oct 26, 2022
c8c347f
update and add some features
neoxr Oct 26, 2022
673272c
update and add some features
neoxr Oct 26, 2022
039ce53
update and add some features
neoxr Oct 26, 2022
f6d10c4
update and add some features
neoxr Oct 26, 2022
ba414d9
update and add some features
neoxr Oct 26, 2022
9ea2bec
update and add some features
neoxr Oct 26, 2022
e9d87bb
update and add some features
neoxr Oct 26, 2022
7105216
fix profile
neoxr Oct 26, 2022
28f1bc6
fix profile
neoxr Oct 26, 2022
b61fce7
add translate feature
neoxr Oct 26, 2022
6517321
add translate feature
neoxr Oct 26, 2022
bafed47
add translate feature
neoxr Oct 26, 2022
8a14004
+ lyric
neoxr Oct 26, 2022
0f0122f
update antilink
neoxr Oct 27, 2022
c8b1035
update
neoxr Oct 27, 2022
f688b6a
update
neoxr Oct 27, 2022
84d90c9
fix google
neoxr Oct 27, 2022
472a3b0
fix google
neoxr Oct 27, 2022
639c1db
fix google
neoxr Oct 27, 2022
5f4e0f2
fix common
neoxr Oct 27, 2022
c784e26
fix common
neoxr Oct 27, 2022
31972ca
update setmsg
neoxr Oct 27, 2022
8fbbb65
update setmsg
neoxr Oct 27, 2022
7d7aced
update setmsg
neoxr Oct 27, 2022
527094f
fix menu
neoxr Oct 27, 2022
3c7c613
update botstat
neoxr Oct 27, 2022
8f7af4c
fix premium
neoxr Oct 27, 2022
5513cd8
add and fix some faatures
neoxr Oct 31, 2022
9cf8de2
add and fix some features
neoxr Oct 31, 2022
4deccce
add and fix some features
neoxr Oct 31, 2022
ae4fa1a
add some features
neoxr Nov 1, 2022
9a7133a
update baileys
neoxr Nov 1, 2022
5c0daaa
creds
neoxr Nov 1, 2022
6f382e9
outsider removing
neoxr Nov 1, 2022
0b549f3
fix outsider removing
neoxr Nov 1, 2022
dbff57c
fix outsider removing
neoxr Nov 1, 2022
65c1b82
fix outsider removing
neoxr Nov 2, 2022
03ca951
fix outsider removing
neoxr Nov 2, 2022
aa8e1f8
remove msg retry
neoxr Nov 3, 2022
5858201
tiktok example
neoxr Nov 3, 2022
dd430f4
+ yt
neoxr Nov 4, 2022
af5e2e0
group list
neoxr Nov 4, 2022
0202d67
fix localonly
neoxr Nov 6, 2022
6e8e5bd
update lyric search
neoxr Nov 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An automated system (WhatsApp Bot) that can help to do something, search and get
<img width="" src="https://img.shields.io/github/repo-size/neoxr/neoxr-bot?color=green&label=Repo%20Size&style=for-the-badge&logo=appveyor">
</p>

> **NEW!** Implementation of my other project namely Github Database **[@neoxr/gitdb](https://github.com/neoxr/gitdb)** to see **[Click Here](https://github.com/neoxr/neoxr-bot/tree/gitdb)**
> **IMPORTANT!** scan qr **[here](https://replit.com/@wildanizzudin/scan?embed=true)** and save creds.json file in the **[session](https://github.com/neoxr/neoxr-bot/tree/multi-auth/session)** folder

### 乂 Database Setup

Expand Down Expand Up @@ -61,13 +61,13 @@ DATABASE_URL = 'mongodb+srv://neoxrbot:[email protected]/myFirs
### 乂 Installation

```
$ git clone https://github.com/neoxr/neoxr-bot
$ git clone -b 'multi-auth' https://github.com/neoxr/neoxr-bot
```

And then type this on your console.
```
$ npm i
$ node . <session_name>
$ node .
```

**NOTE :**
Expand Down
22 changes: 8 additions & 14 deletions client.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const { useSingleFileAuthState, DisconnectReason, makeInMemoryStore, msgRetryCounterMap, delay } = require('baileys')
const session = process.argv[2] ? process.argv[2] + '.json' : 'session.json'
const { state, saveState } = useSingleFileAuthState(session)
const { useMultiFileAuthState, DisconnectReason, makeInMemoryStore, msgRetryCounterMap, delay } = require('baileys')
const pino = require('pino'), path = require('path'), fs = require('fs'), colors = require('@colors/colors/safe'), qrcode = require('qrcode-terminal')
const spinnies = new (require('spinnies'))()
const { Socket, Serialize, Scandir } = require('./system/extra')
Expand All @@ -16,21 +14,18 @@ global.store = makeInMemoryStore({
})

const connect = async () => {
const { state, saveCreds } = await useMultiFileAuthState('session')
global.db = {users:{}, chats:{}, groups:{}, statistic:{}, sticker:{}, setting:{}, ...(await props.fetch() ||{})}
await props.save(global.db)
global.client = Socket({
logger: pino({
level: 'silent'
}),
printQRInTerminal: true,
msgRetryCounterMap,
browser: ['@neoxr / neoxr-bot', 'Chrome', '1.0.0'],
browser: ['@neoxr / neoxr-bot', 'safari', '1.0.0'],
auth: state,
// To see the latest version : https://web.whatsapp.com/check-update?version=1&platform=web
version: [2, 2238, 7],
getMessage: async (key) => {
return await store.loadMessage(client.decodeJid(key.remoteJid), key.id)
}
version: [2, 2241, 7]
})

store.bind(client.ev)
Expand Down Expand Up @@ -63,11 +58,10 @@ const connect = async () => {
} else {
connect().catch(() => connect())
}
}
// if (update.receivedPendingNotifications) await client.reply(global.owner + '@c.us', Func.texted('bold', `🚩 Successfully connected to WhatsApp.`))
}
})

client.ev.on('creds.update', () => saveState)
client.ev.on('creds.update', saveCreds)

client.ev.on('messages.upsert', async chatUpdate => {
try {
Expand Down Expand Up @@ -116,14 +110,14 @@ const connect = async () => {
if (groupSet.welcome) client.sendMessageModify(room.id, txt, null, {
largeThumb: true,
thumbnail: pic,
url: 'https://chat.whatsapp.com/Dh1USlrqIfmJT6Ji0Pm2pP'
url: global.db.setting.link
})
} else if (room.action == 'remove') {
let txt = (groupSet.text_left != '' ? groupSet.text_left : text_left).replace('+tag', `@${member.split`@`[0]}`).replace('+grup', `${meta.subject}`)
if (groupSet.left) client.sendMessageModify(room.id, txt, null, {
largeThumb: true,
thumbnail: pic,
url: 'https://chat.whatsapp.com/Dh1USlrqIfmJT6Ji0Pm2pP'
url: global.db.setting.link
})
}
})
Expand Down
26 changes: 20 additions & 6 deletions handler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const moment = require('moment-timezone')
moment.tz.setDefault('Asia/Jakarta').locale('id')
moment.tz.setDefault(global.timezone)
module.exports = async (client, m) => {
try {
require('./system/database')(m)
Expand All @@ -19,7 +19,7 @@ module.exports = async (client, m) => {
if (!setting.online) await client.sendPresenceUpdate('unavailable', m.chat)
if (setting.online) await client.sendPresenceUpdate('available', m.chat)
if (setting.debug && !m.fromMe && isOwner) client.reply(m.chat, Func.jsonFormat(m), m)
if (m.isGroup && isBotAdmin) groupSet.localonly = false
if (m.isGroup && !isBotAdmin) groupSet.localonly = false
if (m.isGroup && groupSet.autoread) await client.readMessages([m.key])
if (!m.isGroup) await client.readMessages([m.key])
if (m.isGroup) groupSet.activity = new Date() * 1
Expand All @@ -44,6 +44,12 @@ module.exports = async (client, m) => {
await Func.delay(2000).then(() => client.groupLeave(m.chat))
})
}
if (users && (new Date * 1) >= users.expired && users.expired != 0) {
return client.reply(m.chat, Func.texted('italic', '🚩 Your premium package has expired, thank you for buying and using our service.')).then(async () => {
users.premium = false
users.expired = 0
})
}
if (users) users.lastseen = new Date() * 1
if (chats) {
chats.lastseen = new Date() * 1
Expand Down Expand Up @@ -131,13 +137,14 @@ module.exports = async (client, m) => {
if (setting.self && !isOwner && !m.fromMe) return
if (setting.pluginDisable.includes(name)) return client.reply(m.chat, Func.texted('bold', `🚩 Plugin disabled by Owner.`), m)
if (!m.isGroup && !['owner', 'create_bot'].includes(name) && chats && !isPrem && !users.banned && new Date() * 1 - chats.lastchat < global.timer) continue
if (!m.isGroup && !['owner', 'create_bot'].includes(name) && chats && !isPrem && !users.banned && setting.groupmode) return client.sendMessageModify(m.chat, `🚩 Using bot in private chat only for premium user, upgrade to premium plan only Rp. 5,000,- to get 1K limits.\n\nIf you want to buy contact *${prefixes[0]}owner*`, m, {
if (!m.isGroup && !['owner', 'create_bot'].includes(name) && chats && !isPrem && !users.banned && setting.groupmode) return client.sendMessageModify(m.chat, `🚩 Using bot in private chat only for premium user, upgrade to premium plan only Rp. 10,000,- to get 1K limits for 1 month.\n\nIf you want to buy contact *${prefixes[0]}owner*`, m, {
largeThumb: true,
thumbnail: await Func.fetchBuffer('https://telegra.ph/file/0b32e0a0bb3b81fef9838.jpg'),
url: 'https://chat.whatsapp.com/Dh1USlrqIfmJT6Ji0Pm2pP'
url: setting.link
}).then(() => chats.lastchat = new Date() * 1)
if (!['me', 'owner'].includes(name) && users && (users.banned || new Date - users.banTemp < global.timer)) return
if (m.isGroup && !['activation'].includes(name) && groupSet.mute) continue
if (m.isGroup && !isOwner && /chat.whatsapp.com/i.test(text)) return client.groupParticipantsUpdate(m.chat, [m.sender], 'remove')
if (cmd.cache && cmd.location) {
let file = require.resolve(cmd.location)
Func.reload(file)
Expand All @@ -146,6 +153,13 @@ module.exports = async (client, m) => {
client.reply(m.chat, global.status.errorF, m)
continue
}
if (cmd.restrict && !isOwner && text && new RegExp('\\b' + global.db.setting.toxic.join('\\b|\\b') + '\\b').test(text.toLowerCase())) {
client.reply(m.chat, `🚩 You violated the *Terms & Conditions* of using bots by using blacklisted keywords, as a penalty for your violation being blocked and banned. To unblock and get banned you have to pay *Rp. 10,000,-*`, m).then(() => {
users.banned = true
client.updateBlockStatus(m.sender, 'block')
})
continue
}
if (cmd.owner && !isOwner) {
client.reply(m.chat, global.status.owner, m)
continue
Expand Down Expand Up @@ -209,10 +223,10 @@ module.exports = async (client, m) => {
if (m.isGroup && !['exec'].includes(name) && groupSet.mute) continue
if (setting.pluginDisable.includes(name)) continue
if (!m.isGroup && chats && !isPrem && !users.banned && new Date() * 1 - chats.lastchat < global.timer) continue
if (!m.isGroup && chats && !isPrem && !users.banned && setting.groupmode) return client.sendMessageModify(m.chat, `🚩 Using bot in private chat only for premium user, upgrade to premium plan only Rp. 5,000,- to get 1K limits.\n\nIf you want to buy contact *${prefixes[0]}owner*`, m, {
if (!m.isGroup && chats && !isPrem && !users.banned && !['chatAI'].includes(name) && setting.groupmode) return client.sendMessageModify(m.chat, `🚩 Using bot in private chat only for premium user, upgrade to premium plan only Rp. 10,000,- to get 1K limits for 1 month.\n\nIf you want to buy contact *${prefixes[0]}owner*`, m, {
largeThumb: true,
thumbnail: await Func.fetchBuffer('https://telegra.ph/file/0b32e0a0bb3b81fef9838.jpg'),
url: 'https://chat.whatsapp.com/Dh1USlrqIfmJT6Ji0Pm2pP'
url: setting.link
}).then(() => chats.lastchat = new Date() * 1)
if (setting.self && !['chatAI', 'exec'].includes(name) && !isOwner && !m.fromMe) continue
if (!m.isGroup && ['chatAI'].includes(name) && body && Func.socmed(body)) continue
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@colors/colors":"1.5.0",
"awesome-phonenumber":"~2.59.0",
"axios":"~0.24.0",
"baileys":"4.5.8",
"baileys":"latest",
"cfonts":"~2.10.0",
"chalk":"~4.1.0",
"cheerio":"~1.0.0-rc.5",
Expand All @@ -34,7 +34,6 @@
"crypto": "1.0.1",
"dotenv": "^16.0.1",
"express": "~4.16.4",
"got":"^11.8.1",
"fs":"0.0.1-security",
"file-type":"~16.5.2",
"fluent-ffmpeg": "^2.1.2",
Expand All @@ -56,6 +55,7 @@
"rootpath": "^0.1.2",
"spinnies":"~0.5.1",
"syntax-error":"~1.4.0",
"translate-google-api": "~1.0.4",
"usetube": "^2.1.4",
"util":"~0.12.4",
"wa-sticker-formatter": "3.6.0"
Expand Down
33 changes: 33 additions & 0 deletions plugins/admin/outsider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
exports.run = {
usage: ['outsider'],
use: '(option)',
category: 'admin tools',
async: async (m, {
client,
args,
isPrefix,
command,
participants
}) => {
try {
let member = participants.filter(v => !v.admin).map(v => v.id).filter(v => !v.startsWith('62') && v != client.decodeJid(client.user.id))
if (!args || !args[0]) {
if (member.length == 0) return client.reply(m.chat, Func.texted('bold', `🚩 This group is clean from outsiders.`), m)
let teks = `🚩 *${member.length}* outsiders found, send *${isPrefix + command} -y* to remove them.\n\n`
teks += member.map(v => '◦ @' + v.replace(/@.+/, '')).join('\n')
client.reply(m.chat, teks, m)
} else if (args[0] == '-y') {
for (let jid of member) {
await Func.delay(2000)
await client.groupParticipantsUpdate(m.chat, [jid], 'remove')
}
await client.reply(m.chat, Func.texted('bold', `🚩 Done, ${member.length} outsiders successfully removed.`), m)
}
} catch (e) {
client.reply(m.chat, Func.jsonFormat(e), m)
}
},
admin: true,
group: true,
botAdmin: true
}
3 changes: 2 additions & 1 deletion plugins/admin/settext.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
exports.run = {
usage: ['setwelcome', 'setleft', 'setout'],
usage: ['setwelcome', 'setleft'],
hidden: ['setout'],
use: 'text',
category: 'admin tools',
async: async (m, {
Expand Down
6 changes: 3 additions & 3 deletions plugins/converter/emojimix.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exports.run = {
usage: ['emojimix'],
hidden: ['mix', 'emojimix'],
hidden: ['mix', 'emomix'],
use: 'emoji + emoji',
category: 'converter',
async: async (m, {
Expand All @@ -13,9 +13,9 @@ exports.run = {
let exif = global.db.setting
if (!text) return client.reply(m.chat, Func.example(isPrefix, command, '😳+😩'), m)
let [emo1, emo2] = text.split`+`
if (!emo1 || !emo2) return client.reply(m.chat, Func.texted('bold', `🚩 Berikan 2 emoticon untuk di mix.`), m)
if (!emo1 || !emo2) return client.reply(m.chat, Func.texted('bold', `🚩 Give 2 emoticons to mix.`), m)
let json = await Api.emojimix(emo1 + '_' + emo2)
if (!json.status) return client.reply(m.chat, Func.texted('bold', `🚩 Emoticon tidak bisa di mix.`), m)
if (!json.status) return client.reply(m.chat, Func.texted('bold', `🚩 Emoticons can't be mixed.`), m)
await client.sendSticker(m.chat, await Func.fetchBuffer(json.data.url), m, {
packname: exif.sk_pack,
author: exif.sk_author,
Expand Down
7 changes: 3 additions & 4 deletions plugins/converter/tomp3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { readFileSync: read, unlinkSync: remove } = require('fs')
const { readFileSync: read, unlinkSync: remove, writeFileSync: create } = require('fs')
const path = require('path')
const { exec } = require('child_process')
const { tmpdir } = require('os')
Expand Down Expand Up @@ -35,7 +35,7 @@ exports.run = {
client.reply(m.chat, global.status.wait, m)
let buffer = await m.quoted.download()
const media = path.join(tmpdir(), Func.filename('mp3'))
let save = fs.writeFileSync(media, buffer)
let save = create(media, buffer)
const result = Func.filename('mp3')
exec(`ffmpeg -i ${media} ${result}`, async (err, stderr, stdout) => {
remove(media)
Expand Down Expand Up @@ -72,8 +72,7 @@ exports.run = {
}
}
} catch (e) {
console.log(e)
return client.reply(m.chat, global.status.error, m)
return client.reply(m.chat, Func.jsonFormat(e), m)
}
},
error: false,
Expand Down
2 changes: 1 addition & 1 deletion plugins/download/igs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports.run = {
client.sendFile(m.chat, json.data[i].url, ``, `🍟 *Fetching* : ${((new Date - old) * 1)} ms (${i+1})`, m)
await Func.delay(1500)
}
await Func.delay(1500)
await Func.delay(3000)
client.reply(m.chat, Func.texted('bold', `✅ Done, all stories successfully downloaded.`), m)
} catch (e) {
console.log(e)
Expand Down
2 changes: 1 addition & 1 deletion plugins/download/tiktok.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports.run = {
command
}) => {
try {
if (!args || !args[0]) return client.reply(m.chat, Func.example(isPrefix, command, 'https://vt.tiktok.com/ZSe22y3dA'), m)
if (!args || !args[0]) return client.reply(m.chat, Func.example(isPrefix, command, 'https://vm.tiktok.com/ZSR7c5G6y/'), m)
if (!args[0].match('tiktok.com')) return client.reply(m.chat, global.status.invalid, m)
client.sendReact(m.chat, '🕒', m.key)
let old = new Date()
Expand Down
Loading