§r§r "fix"

This commit is contained in:
ChomeNS 2022-10-15 11:18:58 +07:00
parent 82c5ed0457
commit 479e132e15
2 changed files with 8 additions and 8 deletions

View file

@ -21,7 +21,7 @@ function inject(bot) {
if (raw.match(/.* .*§r: §.*/g)) {
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
const username = raw.replace(/.*?\[.*?\] /, '').replace(/:.*/g, '').replace(/§#....../gm, '');
const message = raw.split('§r: ')[1].substr(2);
const message = raw.split('§r: ')[1].substring(2);
bot.emit('message', username, message, packet.sender);
} else if (raw.match(/.* .*: .*/g)) {
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
@ -31,24 +31,24 @@ function inject(bot) {
} else if (raw.match(/.* .*\u203a .*/g)) {
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0];
const message = raw.split('\u203a ')[1].substr(4);
const message = raw.split('\u203a ')[1].substring(2);
bot.emit('message', username, message, packet.sender);
} else if (raw.match(/.* .*\u00BB .*/g)) {
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0];
const message = raw.split('\u00BB ')[1].substr(4);
const message = raw.split('\u00BB ')[1].substring(2);
bot.emit('message', username, message, packet.sender);
} else if (raw.match(/<.*§r> .*/g)) {
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
const username = raw.substr(3).split('§r>')[0];
const username = raw.substring(3).split('§r>')[0];
const message = raw.split('§r> ')[1];
bot.emit('message', username, message, packet.sender);
} else if (raw.match(/<.*> .*/g)) {
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
const username = raw.substr(3).split('>')[0];
const username = raw.substring(3).split('>')[0];
const message = raw.split('> ')[1];
bot.emit('message', username, message, packet.sender);

View file

@ -8,8 +8,8 @@ function inject(bot, dcclient) {
bot.command_handler.commands = loadFiles(path.join(__dirname, '../commands'));
bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc) {
let raw;
if (typeof message.content!=='undefined') raw = message.content.substr(prefix.length);
if (typeof message.content==='undefined') raw = message.substr(prefix.length);
if (typeof message.content!=='undefined') raw = message.content.substring(prefix.length);
if (typeof message.content==='undefined') raw = message.substring(prefix.length);
const [commandName, ...args] = raw.split(' ');
var command = bot.command_handler.commands.find((command) => command.name === commandName.toLowerCase());
try {
@ -52,7 +52,7 @@ function inject(bot, dcclient) {
const sender = bot.options.host === 'sus.shhnowisnottheti.me' && senderr !== '00000000-0000-0000-0000-000000000000' ? senderr : bot.playersAddedPlayers[usernameraw];
if (!sender) return;
const username = bot.getplayerusername[sender];
const message = messagee.replace(/§r/g /* /§[a-f0-9rlonmk]/g */, '')/* .replace(/§/g, '')*/;
const message = messagee.replace(/* /§r/g */ /§[a-f0-9rlonmk]/g, '')/* .replace(/§/g, '')*/;
bot.command_handler.run(username, usernameraw, message, sender);
} catch (e) {
return;