mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2025-03-24 02:49:44 -04:00
*music stop fix + comment packet.sender check
This commit is contained in:
parent
81fe6317fb
commit
58d5f0258e
3 changed files with 3 additions and 3 deletions
|
@ -71,6 +71,7 @@ module.exports = {
|
||||||
playUrl(bot, args.slice(1));
|
playUrl(bot, args.slice(1));
|
||||||
}
|
}
|
||||||
if (args[0]==='stop') {
|
if (args[0]==='stop') {
|
||||||
|
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Stopped playing '}, {text: bot.music.song.name, color: 'gold'}]));
|
||||||
bot.music.stop();
|
bot.music.stop();
|
||||||
}
|
}
|
||||||
if (args[0]==='loop') {
|
if (args[0]==='loop') {
|
||||||
|
|
|
@ -19,14 +19,14 @@ function inject(bot) {
|
||||||
try {
|
try {
|
||||||
const raw = message.toMotd().substring(0, 32767);
|
const raw = message.toMotd().substring(0, 32767);
|
||||||
if (raw.match(/<.*§r> .*/g)) {
|
if (raw.match(/<.*§r> .*/g)) {
|
||||||
if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
||||||
|
|
||||||
const username = raw.substr(3).split('§r>')[0];
|
const username = raw.substr(3).split('§r>')[0];
|
||||||
const message = raw.split('§r> §r')[1];
|
const message = raw.split('§r> §r')[1];
|
||||||
|
|
||||||
bot.emit('message', username, message, packet.sender);
|
bot.emit('message', username, message, packet.sender);
|
||||||
} else if (raw.match(/<.*> .*/g)) {
|
} else if (raw.match(/<.*> .*/g)) {
|
||||||
if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
||||||
|
|
||||||
const username = raw.substr(3).split('>')[0];
|
const username = raw.substr(3).split('>')[0];
|
||||||
const message = raw.split('> ')[1];
|
const message = raw.split('> ')[1];
|
||||||
|
|
|
@ -67,7 +67,6 @@ function inject(bot) {
|
||||||
};
|
};
|
||||||
|
|
||||||
bot.music.stop = function() {
|
bot.music.stop = function() {
|
||||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Stopped playing '}, {text: bot.music.song.name, color: 'gold'}]));
|
|
||||||
bot.music.song = null;
|
bot.music.song = null;
|
||||||
bot.music.loop = false;
|
bot.music.loop = false;
|
||||||
resetTime();
|
resetTime();
|
||||||
|
|
Loading…
Add table
Reference in a new issue