mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-27 09:35:35 -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) {
|
||||
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(' ')}`);
|
||||
} else {
|
||||
throw new Error('You\'re not in the trusted role!');
|
||||
|
|
|
@ -16,14 +16,14 @@ module.exports = {
|
|||
usage: '<hash>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
if (args[0] === bot.hash) {
|
||||
if (args[0] === bot.hash) {
|
||||
crash(bot);
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
},
|
||||
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);
|
||||
} else {
|
||||
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) {
|
||||
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
||||
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
|
||||
bot.end('end command');
|
||||
} else {
|
||||
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'}]);
|
||||
}
|
||||
|
||||
if (command.name === args[0]) m();
|
||||
if (command.name === args[0]) m();
|
||||
for (const alias of command.alias) {
|
||||
if (alias === args[0]) m();
|
||||
if (alias === args[0]) m();
|
||||
}
|
||||
};
|
||||
} 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'}]);
|
||||
}
|
||||
},
|
||||
|
@ -76,9 +76,9 @@ module.exports = {
|
|||
channeldc.send({embeds: [Embed]});
|
||||
}
|
||||
|
||||
if (command.name === args[0]) m();
|
||||
if (command.name === args[0]) m();
|
||||
for (const alias of command.alias) {
|
||||
if (alias === args[0]) m();
|
||||
if (alias === args[0]) m();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
@ -94,7 +94,7 @@ module.exports = {
|
|||
}
|
||||
const Embed = new MessageEmbed()
|
||||
.setColor('#FFFF00')
|
||||
.setTitle('Commands')
|
||||
.setTitle(`Commands (Length: ${bot.command_handler.commands.length})`)
|
||||
.setDescription('**Supported Commands**\n' + supportedCommands + '\n**Unsupported Commands**\n' + unsupportedCommands);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
}
|
||||
|
|
|
@ -21,29 +21,29 @@ function inject(bot) {
|
|||
try {
|
||||
const raw = message.toMotd().substring(0, 32767);
|
||||
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 message = raw.split(': ')[1];
|
||||
bot.emit('message', username, message, packet.sender);
|
||||
} 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 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;
|
||||
// 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].substring(2);
|
||||
bot.emit('message', username, message, packet.sender);
|
||||
} 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 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;
|
||||
// if (packet.sender === '00000000-0000-0000-0000-000000000000') return;
|
||||
|
||||
const username = raw.substring(3).split('>')[0];
|
||||
const message = raw.split('> ')[1];
|
||||
|
|
|
@ -37,7 +37,7 @@ function inject(bot, dcclient, config) {
|
|||
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 = {
|
||||
x: core.start.x + relativePosition.x,
|
||||
|
|
|
@ -148,7 +148,7 @@ function inject(bot) {
|
|||
|
||||
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);
|
||||
|
||||
return;
|
||||
|
|
|
@ -16,7 +16,7 @@ const styles = {
|
|||
|
||||
function stylize(str, styleType) {
|
||||
const style = styles[styleType];
|
||||
if (style !== undefined) return `${style}${str}\xa7r`;
|
||||
if (style !== undefined) return `${style}${str}\xa7r`;
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable max-len */
|
||||
function isAllowedCharacter(character) {
|
||||
return character !== '\xa7' && character >= ' ' && character !== '\x7f';
|
||||
return character !== '\xa7' && character >= ' ' && character !== '\x7f';
|
||||
}
|
||||
function containsIllegalCharacters(string) {
|
||||
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)
|
||||
return true
|
||||
} catch (error) {
|
||||
if (error.code !== 'ENOENT') throw error
|
||||
if (error.code !== 'ENOENT') throw error
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ function parseText(string) {
|
|||
* @return {string} The parsed raw string.
|
||||
*/
|
||||
function parseJson(json, parent) {
|
||||
if (typeof json === 'string') json = {text: json};
|
||||
if (typeof json === 'string') json = {text: json};
|
||||
|
||||
json.color ??= parent.color;
|
||||
json.bold ??= parent.bold;
|
||||
|
@ -110,7 +110,7 @@ function parseJson(json, parent) {
|
|||
let i = 0;
|
||||
|
||||
raw += language[json.translate].replace(/%(?:(\d+)\$)?(s|%)/g, (g0, g1) => {
|
||||
if (g0 === '%%') {
|
||||
if (g0 === '%%') {
|
||||
return '%';
|
||||
} else {
|
||||
const idx = g1 ? parseInt(g1) : i++;
|
||||
|
@ -132,7 +132,7 @@ function parseJson(json, parent) {
|
|||
|
||||
// Remove trailing section signs
|
||||
let end = raw.length;
|
||||
while (raw[end - 1] === '§') end--;
|
||||
while (raw[end - 1] === '§') end--;
|
||||
raw = raw.substring(0, end);
|
||||
|
||||
if (json.extra) {
|
||||
|
|
Loading…
Reference in a new issue