add comments and add zwsp to discord

(to prevent error)
This commit is contained in:
ChomeNS 2022-10-15 13:19:37 +07:00
parent 21a93ef844
commit 95efcda2c3

View file

@ -206,7 +206,7 @@ function main() {
discordQueue = setInterval(function() {
if (dcmsg.queue!='') {
channel.send(dcmsg.queue.substring(0, 1998));
channel.send(dcmsg.queue.substring(0, 1997) + '\u200b');
dcmsg.queue = '';
}
}, 1000);
@ -292,13 +292,14 @@ function main() {
});
bot.on('parsed_chat', async function(message, data) {
// try catch prevents hi % exploit (it uses prismarine-chat) and json parse error
try {
if (previusMessage===message.toString()) return;
previusMessage = message.toString();
// prevents command set message and hi % exploit (it uses prismarine-chat)
const parsedMessage = JSON.parse(data.message);
if (parsedMessage.translate==='translation.test.invalid') return;
// down here it prevents command set message
if (parsedMessage.translate==='advMode.setCommand.success') return;
if (parsedMessage.extra!==undefined) {
if (parsedMessage.extra[0].text==='Command set: ') return;