just change event name

This commit is contained in:
ChomeNS 2022-12-12 15:06:50 +07:00
parent 17c7fbf158
commit a155a50100
8 changed files with 8 additions and 8 deletions

View file

@ -74,7 +74,7 @@ function inject (bot, dcclient, config) {
bot._client.on('system_chat', listener)
bot._client.on('chat', listener)
bot.on('parsed_chat', (message, packet) => parsePlayerMessages(message, packet, bot))
bot.on('message', (message, packet) => parsePlayerMessages(message, packet, bot))
}
module.exports = { inject }

View file

@ -63,7 +63,7 @@ function inject (bot, dcclient, config) {
}
let previousMessage = { username: '', message: '' }
let ratelimit = 0
bot.on('message', async (_username, _message, _sender) => {
bot.on('chat', async (_username, _message, _sender) => {
// try catch cuz TypeError: Cannot read properties of undefined (reading 'replace')
try {
if (

View file

@ -33,7 +33,7 @@ function inject (bot, _dcclient, config, rl) {
// previous message is op feature to have in console :)
let previousMessage = ''
bot.on('parsed_chat', (message) => {
bot.on('message', (message) => {
if (!bot.options.logging) return
if (previousMessage === message.toString()) return
previousMessage = message.toString()

View file

@ -17,7 +17,7 @@ async function inject (bot, dcclient, config) {
queue = ''
}, 1000)
bot.on('parsed_chat', (message) => {
bot.on('message', (message) => {
const cleanMessage = escapeMarkdown(message.toAnsi(), true)
const discordMsg = cleanMessage
.replaceAll('@', '@\u200b')

View file

@ -8,7 +8,7 @@ function inject (bot, client, target) {
target.on('chat', listener)
target.on('system_chat', listener)
target.on('parsed_chat', (message, packet) => {
target.on('message', (message, packet) => {
parsePlayerMessages(message, packet, target)
})
};

View file

@ -4,7 +4,7 @@ function inject (bot, client, target, config) {
let op = true
let gameMode = 1
target.on('parsed_chat', (data) => {
target.on('message', (data) => {
if (data.toString() === 'Successfully enabled CommandSpy' || data.toString() === ' Enabled your command spy.' || data.toString() === ' Your command spy is already enabled.') cspy = true
if (data.toString() === 'Successfully disabled CommandSpy' || data.toString() === ' Disabled your command spy.') cspy = false
})

View file

@ -8,7 +8,7 @@ function inject (bot, dcclient, config) {
let muted = false
let endCredits = false
bot.on('parsed_chat', (data) => {
bot.on('message', (data) => {
if (data.toString() === 'You are now completely invisible to normal users, and hidden from in-game commands.') vanish = true
if (!bot.visibility &&
data.toString().startsWith('Vanish for ') &&

View file

@ -23,7 +23,7 @@ function chatPacketListener (packet, bot, mc119) {
const message = ChatMessage.fromNotch(mc119 ? packet.content : packet.message)
bot.emit('parsed_chat', message, packet)
bot.emit('message', message, packet)
} catch (e) {
bot.console.error(e)
}