Skip to content

Added fix to issue #10#13

Open
XeynQ4 wants to merge 1 commit intonullsoepic:mainfrom
XeynQ4:main
Open

Added fix to issue #10#13
XeynQ4 wants to merge 1 commit intonullsoepic:mainfrom
XeynQ4:main

Conversation

@XeynQ4
Copy link
Contributor

@XeynQ4 XeynQ4 commented Nov 30, 2022

Added kick protection. If someone sends a long message it splits it and it send the messages every second to prevent kick for too many messsages sent. (Issue #10 )

…d it send the messages every second to prevent kick for too many messsages sent. (Issue nullsoepic#10)
@XeynQ4
Copy link
Contributor Author

XeynQ4 commented Nov 30, 2022

I havent tested it yet cause i don't have a bot set up but it should work

Copy link

@112batman 112batman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use setInterval(lambda) instead as it's non-blocking

messageQueue.push(message.content);
}

while (messageQueue.length > 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A while true loop hangs the program I think

while (messageQueue.length > 0) {
if (!sending) {
bot.write('chat_message', {
message: message.author.tag + ' > ' + messageQueue[0],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace this with messageQueue.shift()

lastMessage: null
}); // Send the message to minecraft chat

messageQueue.shift();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then remove this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants