mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-12-17 19:02:22 -05:00
help commands length + === with 2 spaces fix
This commit is contained in:
parent
acf6f0cb00
commit
f8da684785
11 changed files with 23 additions and 23 deletions
|
@ -13,7 +13,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||||
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
||||||
bot.core.run(`essentials:sudo * ${args.join(' ')}`);
|
bot.core.run(`essentials:sudo * ${args.join(' ')}`);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('You\'re not in the trusted role!');
|
throw new Error('You\'re not in the trusted role!');
|
||||||
|
|
|
@ -16,14 +16,14 @@ module.exports = {
|
||||||
usage: '<hash>',
|
usage: '<hash>',
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||||
if (args[0] === bot.hash) {
|
if (args[0] === bot.hash) {
|
||||||
crash(bot);
|
crash(bot);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Invalid hash');
|
throw new Error('Invalid hash');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||||
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
||||||
crash(bot);
|
crash(bot);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('You\'re not in the trusted role!');
|
throw new Error('You\'re not in the trusted role!');
|
||||||
|
|
|
@ -13,7 +13,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||||
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
||||||
bot.end('end command');
|
bot.end('end command');
|
||||||
} else {
|
} else {
|
||||||
throw new Error('You\'re not in the trusted role!');
|
throw new Error('You\'re not in the trusted role!');
|
||||||
|
|
|
@ -42,13 +42,13 @@ module.exports = {
|
||||||
bot.tellraw('@a', [{text: prefix + command.name, color: 'gold'}, {text: ' ' + command.usage, color: 'aqua'}]);
|
bot.tellraw('@a', [{text: prefix + command.name, color: 'gold'}, {text: ' ' + command.usage, color: 'aqua'}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.name === args[0]) m();
|
if (command.name === args[0]) m();
|
||||||
for (const alias of command.alias) {
|
for (const alias of command.alias) {
|
||||||
if (alias === args[0]) m();
|
if (alias === args[0]) m();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const pre = [{'text': 'Commands ', 'color': 'gray'}, {'text': '(', 'color': 'gray'}, {'text': '⬤ Public', 'color': 'green'}, {'text': ' ⬤ Trusted', 'color': 'red'}, {'text': ' ⬤ Owner', 'color': 'dark_red'}, {'text': ') -', 'color': 'gray'}];
|
const pre = [{text: 'Commands ', color: 'gray'}, {text: '(', color: 'dark_gray'}, {text: 'Length: ', color: 'gray'}, {text: bot.command_handler.commands.length, color: 'green'}, {text: ') ', color: 'dark_gray'}, {text: '(', color: 'dark_gray'}, {text: '⬤ Public', color: 'green'}, {text: ' ⬤ Trusted', color: 'red'}, {text: ' ⬤ Owner', color: 'dark_red'}, {text: ') -', color: 'dark_gray'}];
|
||||||
bot.tellraw('@a', [pre, {text: generalCommands, color: 'green'}, {text: trustedCommands, color: 'red'}, {text: ownerCommands, color: 'dark_red'}]);
|
bot.tellraw('@a', [pre, {text: generalCommands, color: 'green'}, {text: trustedCommands, color: 'red'}, {text: ownerCommands, color: 'dark_red'}]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -76,9 +76,9 @@ module.exports = {
|
||||||
channeldc.send({embeds: [Embed]});
|
channeldc.send({embeds: [Embed]});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.name === args[0]) m();
|
if (command.name === args[0]) m();
|
||||||
for (const alias of command.alias) {
|
for (const alias of command.alias) {
|
||||||
if (alias === args[0]) m();
|
if (alias === args[0]) m();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
@ -94,7 +94,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor('#FFFF00')
|
.setColor('#FFFF00')
|
||||||
.setTitle('Commands')
|
.setTitle(`Commands (Length: ${bot.command_handler.commands.length})`)
|
||||||
.setDescription('**Supported Commands**\n' + supportedCommands + '\n**Unsupported Commands**\n' + unsupportedCommands);
|
.setDescription('**Supported Commands**\n' + supportedCommands + '\n**Unsupported Commands**\n' + unsupportedCommands);
|
||||||
channeldc.send({embeds: [Embed]});
|
channeldc.send({embeds: [Embed]});
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,29 +21,29 @@ function inject(bot) {
|
||||||
try {
|
try {
|
||||||
const raw = message.toMotd().substring(0, 32767);
|
const raw = message.toMotd().substring(0, 32767);
|
||||||
if (raw.match(/.* .*: .*/g)) {
|
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.replace(/.*?\[.*?\] /, '').replace(/:.*/g, '').replace(/§#....../gm, '');
|
const username = raw.replace(/.*?\[.*?\] /, '').replace(/:.*/g, '').replace(/§#....../gm, '');
|
||||||
const message = raw.split(': ')[1];
|
const message = raw.split(': ')[1];
|
||||||
bot.emit('message', username, message, packet.sender);
|
bot.emit('message', username, message, packet.sender);
|
||||||
} else if (raw.match(/.* .*\u203a .*/g)) {
|
} else if (raw.match(/.* .*\u203a .*/g)) {
|
||||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0];
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0];
|
||||||
const message = raw.split('\u203a ')[1].substring(2);
|
const message = raw.split('\u203a ')[1].substring(2);
|
||||||
bot.emit('message', username, message, packet.sender);
|
bot.emit('message', username, message, packet.sender);
|
||||||
} else if (raw.match(/.* .*\u00BB .*/g)) {
|
} else if (raw.match(/.* .*\u00BB .*/g)) {
|
||||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0];
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0];
|
||||||
const message = raw.split('\u00BB ')[1].substring(2);
|
const message = raw.split('\u00BB ')[1].substring(2);
|
||||||
bot.emit('message', username, message, packet.sender);
|
bot.emit('message', username, message, packet.sender);
|
||||||
} else if (raw.match(/<.*§r> .*/g)) {
|
} else 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.substring(3).split('§r>')[0];
|
const username = raw.substring(3).split('§r>')[0];
|
||||||
const message = raw.split('§r> ')[1];
|
const message = raw.split('§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.substring(3).split('>')[0];
|
const username = raw.substring(3).split('>')[0];
|
||||||
const message = raw.split('> ')[1];
|
const message = raw.split('> ')[1];
|
||||||
|
|
|
@ -37,7 +37,7 @@ function inject(bot, dcclient, config) {
|
||||||
relativePosition.z = 0;
|
relativePosition.z = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const impulseMode = bot.options.host === '0.tcp.ap.ngrok.io';
|
const impulseMode = bot.options.host === '0.tcp.ap.ngrok.io';
|
||||||
|
|
||||||
const location = {
|
const location = {
|
||||||
x: core.start.x + relativePosition.x,
|
x: core.start.x + relativePosition.x,
|
||||||
|
|
|
@ -148,7 +148,7 @@ function inject(bot) {
|
||||||
|
|
||||||
const players = await bot.requester.getPlayerList();
|
const players = await bot.requester.getPlayerList();
|
||||||
|
|
||||||
if (fullPlayer && players.some((name) => name === fullPlayer.name)) {
|
if (fullPlayer && players.some((name) => name === fullPlayer.name)) {
|
||||||
bot.emit('player_vanished', player);
|
bot.emit('player_vanished', player);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -16,7 +16,7 @@ const styles = {
|
||||||
|
|
||||||
function stylize(str, styleType) {
|
function stylize(str, styleType) {
|
||||||
const style = styles[styleType];
|
const style = styles[styleType];
|
||||||
if (style !== undefined) return `${style}${str}\xa7r`;
|
if (style !== undefined) return `${style}${str}\xa7r`;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
function isAllowedCharacter(character) {
|
function isAllowedCharacter(character) {
|
||||||
return character !== '\xa7' && character >= ' ' && character !== '\x7f';
|
return character !== '\xa7' && character >= ' ' && character !== '\x7f';
|
||||||
}
|
}
|
||||||
function containsIllegalCharacters(string) {
|
function containsIllegalCharacters(string) {
|
||||||
for (let i = 0; i < string.length; i++) if (!isAllowedCharacter(string[i])) return true;
|
for (let i = 0; i < string.length; i++) if (!isAllowedCharacter(string[i])) return true;
|
||||||
|
|
|
@ -5,7 +5,7 @@ async function fileExists (filepath) {
|
||||||
await fs.access(filepath)
|
await fs.access(filepath)
|
||||||
return true
|
return true
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code !== 'ENOENT') throw error
|
if (error.code !== 'ENOENT') throw error
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ function parseText(string) {
|
||||||
* @return {string} The parsed raw string.
|
* @return {string} The parsed raw string.
|
||||||
*/
|
*/
|
||||||
function parseJson(json, parent) {
|
function parseJson(json, parent) {
|
||||||
if (typeof json === 'string') json = {text: json};
|
if (typeof json === 'string') json = {text: json};
|
||||||
|
|
||||||
json.color ??= parent.color;
|
json.color ??= parent.color;
|
||||||
json.bold ??= parent.bold;
|
json.bold ??= parent.bold;
|
||||||
|
@ -110,7 +110,7 @@ function parseJson(json, parent) {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
raw += language[json.translate].replace(/%(?:(\d+)\$)?(s|%)/g, (g0, g1) => {
|
raw += language[json.translate].replace(/%(?:(\d+)\$)?(s|%)/g, (g0, g1) => {
|
||||||
if (g0 === '%%') {
|
if (g0 === '%%') {
|
||||||
return '%';
|
return '%';
|
||||||
} else {
|
} else {
|
||||||
const idx = g1 ? parseInt(g1) : i++;
|
const idx = g1 ? parseInt(g1) : i++;
|
||||||
|
@ -132,7 +132,7 @@ function parseJson(json, parent) {
|
||||||
|
|
||||||
// Remove trailing section signs
|
// Remove trailing section signs
|
||||||
let end = raw.length;
|
let end = raw.length;
|
||||||
while (raw[end - 1] === '§') end--;
|
while (raw[end - 1] === '§') end--;
|
||||||
raw = raw.substring(0, end);
|
raw = raw.substring(0, end);
|
||||||
|
|
||||||
if (json.extra) {
|
if (json.extra) {
|
||||||
|
|
Loading…
Reference in a new issue