Archived
Make echo send the message normally, and don't use non-initialized memory for the acknowledged buffer
This commit is contained in:
+15
-1
@@ -16,6 +16,20 @@ module.exports = {
|
||||
|
||||
echoCommand (context) {
|
||||
const bot = context.source.bot
|
||||
bot.core.run(`essentials:sudo ${bot.uuid} c:${context.getArgument('message')}`)
|
||||
bot.chat.queue.push(this.sanitize(context.getArgument('message')))
|
||||
},
|
||||
|
||||
sanitize (message) {
|
||||
let clean = ''
|
||||
|
||||
for (let i = 0; i < message.length && clean.length < 256; i++) {
|
||||
const c = message[i]
|
||||
const cc = c.charCodeAt(0)
|
||||
|
||||
if (cc < 0x20 || cc === 0x7f || cc === 0xa7) continue
|
||||
clean += c
|
||||
}
|
||||
|
||||
return clean
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ function inject (bot) {
|
||||
timestamp: BigInt(Date.now()),
|
||||
salt: 0n,
|
||||
offset: 0,
|
||||
acknowledged: Buffer.allocUnsafe(3)
|
||||
acknowledged: Buffer.alloc(3)
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user