mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 01:25:33 -05:00
clear chat queue fix
This commit is contained in:
parent
ddb1dbd32c
commit
666cc2491f
2 changed files with 9 additions and 7 deletions
|
@ -5,13 +5,15 @@ module.exports = {
|
|||
usage: '',
|
||||
trusted: 0,
|
||||
execute (bot) {
|
||||
if (bot.queue[0]) {
|
||||
if (bot._chatQueue[0]) {
|
||||
bot.chatQueue = []
|
||||
bot._chatQueue = []
|
||||
}
|
||||
},
|
||||
discordExecute (bot) {
|
||||
if (bot.queue[0]) {
|
||||
if (bot._chatQueue[0]) {
|
||||
bot.chatQueue = []
|
||||
bot._chatQueue = []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ const { chatPacketListener, parsePlayerMessages } = require('../util/chat')
|
|||
|
||||
function inject (bot, dcclient, config) {
|
||||
bot.chatQueue = []
|
||||
const _chatQueue = []
|
||||
bot._chatQueue = []
|
||||
|
||||
const _chatQueueInterval = setInterval(() => {
|
||||
if (bot.chatQueue.length !== 0) {
|
||||
|
@ -20,7 +20,7 @@ function inject (bot, dcclient, config) {
|
|||
let smallMsg
|
||||
for (let i = 0; i < subMessage.length; i += config.chat.messageLength) {
|
||||
smallMsg = subMessage.substring(i, i + config.chat.messageLength)
|
||||
_chatQueue.push(smallMsg)
|
||||
bot._chatQueue.push(smallMsg)
|
||||
}
|
||||
})
|
||||
bot.chatQueue.shift()
|
||||
|
@ -28,9 +28,9 @@ function inject (bot, dcclient, config) {
|
|||
}, 0)
|
||||
|
||||
const chatQueueInterval = setInterval(function () {
|
||||
if (_chatQueue.length !== 0) {
|
||||
bot.write('chat', { message: _chatQueue[0] })
|
||||
_chatQueue.shift()
|
||||
if (bot._chatQueue.length !== 0) {
|
||||
bot.write('chat', { message: bot._chatQueue[0] })
|
||||
bot._chatQueue.shift()
|
||||
}
|
||||
}, 450)
|
||||
|
||||
|
|
Loading…
Reference in a new issue