Skip to content

Commit b591003

Browse files
committed
chore(release): bump @neoxr/wb from 6.0.0-rc.2 to 6.0.0-rc.3 and make the script compatible with both old and latest Baileys versions
config: add for custom message id prefix feat: add exception on anti-spam
1 parent 78a11d1 commit b591003

File tree

12 files changed

+25
-31
lines changed

12 files changed

+25
-31
lines changed

client.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as baileys from 'baileys'
21
import { Client, Config, Database, Utils } from '@neoxr/wb'
2+
import baileys from './lib/engine.js'
33
import './error.js'
44
import './lib/config.js'
55
import './lib/functions.js'
@@ -31,8 +31,9 @@ const connect = async () => {
3131
bypass_disappearing: true,
3232
bot: id => {
3333
// Detect message from bot by message ID, you can add another logic here
34-
return id && ((id.startsWith('3EB0') && id.length === 40) || id.startsWith('BAE') || /[-]/.test(id))
34+
return id && (id.startsWith('BAE') || /[-]/.test(id))
3535
},
36+
custom_id: 'neoxr', // Prefix for Custom Message ID (automatically detects isBot for itself)
3637
presence: true, // Set to 'true' if you want to see the bot typing or recording
3738
create_session: {
3839
type: system.session,

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"ram_limit": "900mb",
77
"max_upload": 50,
88
"max_upload_free": 25,
9-
"cooldown": 1,
9+
"cooldown": 3,
1010
"timer": 180000,
1111
"timeout": 1800000,
1212
"permanent_threshold": 3,

handler.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export default async (client, ctx) => {
3434
const isSpam = spam.detection(client, m, {
3535
prefix, command, commands, users, cooldown,
3636
show: 'all', // options: 'all' | 'command-only' | 'message-only' | 'spam-only'| 'none'
37-
banned_times: users.ban_times
37+
banned_times: users.ban_times,
38+
exception: isOwner || isPrem
3839
})
3940

4041
plugins = Object.fromEntries(Object.entries(plugins).filter(([name, _]) => !setting.pluginDisable.includes(name)))
@@ -57,7 +58,7 @@ export default async (client, ctx) => {
5758
})
5859
if (!setting.multiprefix) setting.noprefix = false
5960
if (setting.debug && !m.fromMe && isOwner) client.reply(m.chat, Utils.jsonFormat(m), m)
60-
61+
6162
if (m.isGroup) groupSet.activity = new Date() * 1
6263
if (users) {
6364
if (!users.lid) {
@@ -96,6 +97,8 @@ export default async (client, ctx) => {
9697
groupSet.member[m.sender].lastseen = now
9798
}
9899
}
100+
if (setting.antispam && isSpam && /(BANNED|NOTIFY|TEMPORARY)/.test(isSpam.state)) return client.reply(m.chat, Utils.texted('bold', `🚩 ${isSpam.msg}`), m)
101+
if (setting.antispam && isSpam && /HOLD/.test(isSpam.state)) return
99102
if (body && !setting.self && core.prefix != setting.onlyprefix && commands.includes(core.command) && !setting.multiprefix && !Config.evaluate_chars.includes(core.command)) return client.reply(m.chat, `🚩 *Incorrect prefix!*, this bot uses prefix : *[ ${setting.onlyprefix} ]*\n\n➠ ${setting.onlyprefix + core.command} ${text || ''}`, m)
100103
const matcher = Utils.matcher(command, commands).filter(v => v.accuracy >= 60)
101104
if (prefix && !commands.includes(command) && matcher.length > 0 && !setting.self) {
@@ -109,7 +112,7 @@ export default async (client, ctx) => {
109112
body && !prefix && commands.includes(command) && Config.evaluate_chars.includes(command)
110113
) {
111114
if (setting.error.includes(command)) return client.reply(m.chat, Utils.texted('bold', `🚩 Command _${(prefix ? prefix : '') + command}_ disabled.`), m)
112-
if (!m.isGroup && Config.blocks.some(no => m.sender.startsWith(no))) return client.updateBlockStatus(m.sender, 'block')
115+
if (!m.isGroup && Config.blocks.some(no => m.sender?.startsWith(no))) return client.updateBlockStatus(m.sender, 'block')
113116
if (commands.includes(command)) {
114117
users.hit += 1
115118
users.usebot = new Date() * 1
@@ -134,11 +137,6 @@ export default async (client, ctx) => {
134137
}
135138
if (!['me', 'owner', 'exec'].includes(name) && users && (users.banned || new Date - users.ban_temporary < Config.timeout)) continue
136139
if (m.isGroup && !['activation', 'groupinfo'].includes(name) && groupSet.mute) continue
137-
if (!cmd.exception && setting.antispam && isSpam && /(BANNED|NOTIFY|TEMPORARY)/.test(isSpam.state) && !isOwner) {
138-
client.reply(m.chat, Utils.texted('bold', `🚩 ${isSpam.msg}`), m)
139-
continue
140-
}
141-
if (!cmd.exception && setting.antispam && isSpam && /HOLD/.test(isSpam.state) && !isOwner) continue
142140
if (cmd.owner && !isOwner) {
143141
client.reply(m.chat, global.status.owner, m)
144142
continue
@@ -199,11 +197,6 @@ export default async (client, ctx) => {
199197
thumbnail: await Utils.fetchAsBuffer('https://telegra.ph/file/0b32e0a0bb3b81fef9838.jpg'),
200198
url: setting.link
201199
}).then(() => chats.lastchat = new Date() * 1)
202-
if (!event.exception && setting.antispam && isSpam && /(BANNED|NOTIFY|TEMPORARY)/.test(isSpam.state) && isOwner) {
203-
client.reply(m.chat, Utils.texted('bold', `🚩 ${isSpam.msg}`), m)
204-
continue
205-
}
206-
if (!event.exception && setting.antispam && isSpam && /HOLD/.test(isSpam.state) && !isOwner) continue
207200
if (event.error) continue
208201
if (event.owner && !isOwner) continue
209202
if (event.group && !m.isGroup) continue

lib/engine.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as latest from 'baileys' // this is for latest version of baileys >=7
2+
import past from 'baileys' // this is for old version of baileys <6
3+
const baileys = latest.proto?.WebMessageInfo ? latest : past
4+
export default baileys

lib/models.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const models = {
6060
onlyprefix: '+',
6161
owners: ['994408364923'],
6262
lastReset: new Date * 1,
63-
msg: 'Hi +tag 🪸\nI am an automated system (WhatsApp Bot) that can help to do something, search and get data / information only through WhatsApp.\n\n◦ *Module* : +module\n◦ *Database* : +db\n◦ *Library* : Baileys v+version\n◦ *Rest API* : https://api.neoxr.my.id\n◦ *Source* : https://github.com/neoxr/neoxr-bot\n\nIf you find an error or want to upgrade premium plan contact the owner.',
63+
msg: 'Hi +tag 🪸\nI am an automated system (WhatsApp Bot) that can help to do something, search and get data / information only through WhatsApp.\n\n◦ *Module* : +module\n◦ *Database* : +db\n◦ *Library* : Baileys +version\n◦ *Rest API* : https://api.neoxr.my.id\n◦ *Source* : https://github.com/neoxr/neoxr-bot\n\nIf you find an error or want to upgrade premium plan contact the owner.',
6464
style: 4,
6565
cover: 'https://imgkub.com/images/2025/09/24/image0fe254c6cbb0910a.jpg',
6666
link: 'https://chat.whatsapp.com/D4OaImtQwH48CtlR0yt4Ff'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"homepage": "https://github.com/neoxr/neoxr-bot#readme",
2727
"dependencies": {
2828
"@adiwajshing/keyed-db": "^0.2.4",
29-
"@neoxr/wb": "^6.0.0-rc.2",
29+
"@neoxr/wb": "^6.0.0-rc.3",
3030
"baileys": "^7.0.0-rc.3",
3131
"cfonts": "3.1.1",
3232
"html-entities": "^2.5.2",

plugins/_events/protector/anti_link.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,5 @@ export const run = {
9090
},
9191
error: false,
9292
group: true,
93-
botAdmin: true,
94-
exception: true
93+
botAdmin: true
9594
}

plugins/_events/protector/anti_tagall.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ export const run = {
1313
},
1414
error: false,
1515
group: true,
16-
botAdmin: true,
17-
exception: true
16+
botAdmin: true
1817
}

plugins/_events/protector/anti_tagsw.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ export const run = {
2020
},
2121
error: false,
2222
group: true,
23-
botAdmin: true,
24-
exception: true
23+
botAdmin: true
2524
}

plugins/_events/protector/anti_virtex.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ export const run = {
2020
},
2121
error: false,
2222
group: true,
23-
botAdmin: true,
24-
exception: true
23+
botAdmin: true
2524
}

0 commit comments

Comments
 (0)