rel fix much again

This commit is contained in:
ChomeNS 2022-11-07 20:08:29 +07:00
parent e6455a25fc
commit b1f8f28f4e
18 changed files with 77 additions and 119 deletions

View file

@ -7,7 +7,7 @@ module.exports = {
usage: '',
trusted: 0,
execute: function(bot) {
bot.tellraw('@a', ['', {text: 'The bot\'s username is: ', color: 'white'}, {text: `${bot.username}`, color: 'gold', clickEvent: {action: 'copy_to_clipboard', value: `${bot.username}`}, hoverEvent: {action: 'show_text', contents: [{text: 'Click here to copy the username to your clipboard', color: 'green'}]}}, {text: ' and the UUID is: '}, {text: `${bot.uuid}`, color: 'aqua', clickEvent: {action: 'copy_to_clipboard', value: `${bot.uuid}`}, hoverEvent: {action: 'show_text', contents: [{text: 'Click here to copy the uuid to your clipboard', color: 'green'}]}}]);
bot.tellraw('@a', [{text: 'The bot\'s username is: ', color: 'white'}, {text: `${bot.username}`, color: 'gold', clickEvent: {action: 'copy_to_clipboard', value: `${bot.username}`}, hoverEvent: {action: 'show_text', contents: [{text: 'Click here to copy the username to your clipboard', color: 'green'}]}}, {text: ' and the UUID is: '}, {text: `${bot.uuid}`, color: 'aqua', clickEvent: {action: 'copy_to_clipboard', value: `${bot.uuid}`}, hoverEvent: {action: 'show_text', contents: [{text: 'Click here to copy the uuid to your clipboard', color: 'green'}]}}]);
},
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
const Embed = new MessageEmbed()

View file

@ -11,11 +11,11 @@ module.exports = {
if (args[1] === 'true') {
bot.visibility = true;
bot.chat('/essentials:vanish disable');
bot.tellraw('@a', ['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'visible', color: 'green'}]);
bot.tellraw('@a', [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'visible', color: 'green'}]);
} else if (args[1] === 'false') {
bot.visibility = false;
bot.chat('/essentials:vanish enable');
bot.tellraw('@a', ['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]);
bot.tellraw('@a', [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]);
} else {
throw new SyntaxError('Invalid argument');
}
@ -24,7 +24,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')) {
if (args[0] === 'true') {
bot.visibility = true;
bot.chat('/essentials:vanish disable');

View file

@ -63,87 +63,48 @@ module.exports = {
execute: function(bot, username, usernameraw, sender, prefix, args) {
if (!bot.cloops) bot.cloops = [];
if (args[1] === 'add') {
if (args[0] === bot.hash) {
if (args[3]) {
if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval');
add(args.slice(3).join(' '), args[2], bot);
bot.tellraw('@a', [{text: 'Added command ', color: 'white'}, {text: `${args.slice(3).join(' ')}`, color: 'aqua'}, {text: ' with interval ', color: 'white'}, {text: `${args[2]}`, color: 'green'}, {text: ' to the cloops', color: 'white'}]);
}
} else {
throw new Error('Invalid hash');
}
return;
}
if (args[1] === 'list') {
if (args[0] === bot.hash) {
if (args[0] === bot.hash) {
if (args[1] === 'add' && args[3]) {
if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval');
add(args.slice(3).join(' '), args[2], bot);
bot.tellraw('@a', [{text: 'Added command ', color: 'white'}, {text: `${args.slice(3).join(' ')}`, color: 'aqua'}, {text: ' with interval ', color: 'white'}, {text: `${args[2]}`, color: 'green'}, {text: ' to the cloops', color: 'white'}]);
} else if (args[1] === 'list') {
list(bot);
} else {
throw new Error('Invalid hash');
}
return;
}
if (args[1] === 'remove') {
if (args[0] === bot.hash) {
} else if (args[1] === 'remove') {
remove(args[2]);
bot.tellraw('@a', ['', {text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]);
} else {
throw new Error('Invalid hash');
}
return;
}
if (args[1] === 'removeall') {
if (args[0] === bot.hash) {
bot.tellraw('@a', [{text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]);
} else if (args[1] === 'removeall') {
clear();
bot.tellraw('@a', ['', {text: 'Removed all looped commands', color: 'white'}]);
bot.tellraw('@a', [{text: 'Removed all looped commands', color: 'white'}]);
} else {
throw new Error('Invalid hash');
throw new SyntaxError('Invalid argument');
}
return;
} else {
throw new Error('Invalid hash');
}
},
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
if (!bot.cloops) bot.cloops = [];
if (args[0] === 'add') {
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
if (args[2]) {
if (!Number(args[1]) && Number(args[1]) !== 0) throw new SyntaxError('Invalid interval');
add(args.slice(2).join(' '), args[1], bot);
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setTitle('Cloop')
.setDescription(`Added cloop \`${args.slice(2).join(' ')}\` with interval ${args[1]} to the cloops`);
channeldc.send({embeds: [Embed]});
}
} else {
throw new Error('You\'re not in the trusted role!');
}
return;
}
if (args[0] === 'list') {
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
if (args[0] === 'add' && args[2]) {
if (!Number(args[1]) && Number(args[1]) !== 0) throw new SyntaxError('Invalid interval');
add(args.slice(2).join(' '), args[1], bot);
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setTitle('Cloop')
.setDescription(`Added cloop \`${args.slice(2).join(' ')}\` with interval ${args[1]} to the cloops`);
channeldc.send({embeds: [Embed]});
} else if (args[0] === 'list') {
list(bot, true, channeldc);
} else {
throw new Error('You\'re not in the trusted role!');
}
return;
}
if (args[0] === 'remove') {
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
} else if (args[0] === 'remove') {
remove(args[1]);
const Embed = new MessageEmbed()
.setColor('#FFFF00')
.setTitle('Cloop')
.setDescription(`Removed cloop \`${args[1]}\``);
channeldc.send({embeds: [Embed]});
} else {
throw new Error('You\'re not in the trusted role!');
}
return;
}
if (args[0] === 'removeall') {
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
} else if (args[0] === 'removeall') {
clear();
const Embed = new MessageEmbed()
.setColor('#FFFF00')
@ -151,9 +112,10 @@ module.exports = {
.setDescription('Removed all looped commands');
channeldc.send({embeds: [Embed]});
} else {
throw new Error('You\'re not in the trusted role!');
throw new Error('Invalid argument');
}
return;
} else {
throw new Error('You\'re not in the trusted role!');
}
},
};

View file

@ -8,9 +8,7 @@ module.exports = {
usage: '<cow|list> <message>',
trusted: 0,
execute: function(bot, username, usernameraw, sender, prefix, args) {
if (args[0]!=='list') {
bot.tellraw('@a', {text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`});
} else {
if (args[0]==='list') {
let color = '§6';
let message = '';
@ -23,6 +21,8 @@ module.exports = {
message += color + value + ' ';
});
bot.tellraw('@a', [{text: 'Cows: ', color: 'green'}, '\n', {text: message, color: 'red'}]);
} else {
bot.tellraw('@a', {text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`});
}
},
};

View file

@ -15,10 +15,10 @@ module.exports = {
// if (!entity) throw new SyntaxError('Invalid entity');
// if (!args[1]) {
// bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at @r[\'limit\'=10] run summon minecraft:' + entity.name);
// bot.tellraw('@a', ['', {text: 'Entity ', color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at everyone...', color: 'white'}]);
// bot.tellraw('@a', [{text: 'Entity ', color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at everyone...', color: 'white'}]);
// } else if (args[1] === 'specific' && args[2]) {
// bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at ' + args[2] + ' run summon minecraft:' + entity.name);
// bot.tellraw('@a', ['', {text: `Entity `, color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}]);
// bot.tellraw('@a', [{text: `Entity `, color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}]);
// }
},
};

View file

@ -60,11 +60,9 @@ module.exports = {
} catch (err) {
throw err;
}
}
if (args[0] === 'reset') {
} else if (args[0] === 'reset') {
bot.vm = new VM(bot.vmoptions);
}
if (args[0] === 'server') {
} else if (args[0] === 'server') {
axios
.post(config.eval.serverUrl, querystring.stringify({
html: false,
@ -79,6 +77,8 @@ module.exports = {
}).catch((err) => {
throw err;
});
} else {
throw new SyntaxError('Invalid argument');
}
},
};

View file

@ -12,18 +12,18 @@ module.exports = {
let trustedCommands = '';
let ownerCommands = '';
for (const command of bot.command_handler.commands) {
if (command.trusted!==0) continue;
if (command.trusted !== 0) continue;
generalCommands += ' ' + command.name;
}
for (const command of bot.command_handler.commands) {
if (command.trusted!==1) continue;
if (command.trusted !== 1) continue;
trustedCommands += ' ' + command.name;
}
for (const command of bot.command_handler.commands) {
if (command.trusted!==2) continue;
if (command.trusted !== 2) continue;
ownerCommands += ' ' + command.name;
}
if (typeof args[0]!=='undefined') {
if (typeof args[0] !== 'undefined') {
for (const command of bot.command_handler.commands) {
function m() {
let discordSupported;
@ -33,7 +33,7 @@ module.exports = {
} else {
discordSupported = 'true';
}
if (command.alias.toString()!=='') {
if (command.alias.toString() !== '') {
alias = command.alias.join(', ');
}
bot.tellraw('@a', [{text: prefix + command.name, color: 'gold'}, {text: ` (${alias})`, color: 'white'}, {text: ' - ', color: 'gray'}, {text: command.description, color: 'gray'}]);
@ -53,7 +53,7 @@ module.exports = {
}
},
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) {
if (typeof args[0]!=='undefined') {
if (typeof args[0] !== 'undefined') {
for (const command of bot.command_handler.commands) {
function m() {
let discordSupported;
@ -63,7 +63,7 @@ module.exports = {
} else {
discordSupported = 'true';
}
if (command.alias.toString()!=='') {
if (command.alias.toString() !== '') {
alias = command.alias.join(', ');
}
const Embed = new MessageEmbed()
@ -89,7 +89,7 @@ module.exports = {
supportedCommands += command.name + ' ';
}
for (const command of bot.command_handler.commands) {
if (typeof command.discordExecute!=='undefined') continue;
if (typeof command.discordExecute !== 'undefined') continue;
unsupportedCommands += command.name + ' ';
}
const Embed = new MessageEmbed()

View file

@ -9,11 +9,11 @@ module.exports = {
trusted: 0,
execute: async function(bot) {
try {
bot.tellraw('@a', ['', {text: 'Players:', color: 'green'}]);
bot.tellraw('@a', [{text: 'Players:', color: 'green'}]);
await sleep(60);
for (const property of bot.players.list) {
// if (property.match.startsWith('@')) continue;
bot.tellraw('@a', ['', {text: `${property.name}`, color: 'yellow'}, {text: ' ', color: 'aqua'}, {text: `${property.UUID}`, color: 'aqua'}]);
bot.tellraw('@a', [{text: `${property.name}`, color: 'yellow'}, {text: ' ', color: 'aqua'}, {text: `${property.UUID}`, color: 'aqua'}]);
}
} catch (e) {
return;

View file

@ -136,45 +136,41 @@ module.exports = {
execute: function(bot, username, usernameraw, sender, prefix, args) {
if (args[0] === 'play') {
play(bot, args.slice(1));
}
if (args[0] === 'playurl') {
} else if (args[0] === 'playurl') {
playUrl(bot, args.slice(1));
}
if (args[0] === 'stop') {
} else if (args[0] === 'stop') {
try {
bot.tellraw('@a', {text: 'Cleared the song queue'});
} catch (e) {
return;
}
bot.music.stop();
}
if (args[0] === 'skip') {
} else if (args[0] === 'skip') {
try {
bot.tellraw('@a', [{text: 'Skipping '}, {text: bot.music.song.name, color: 'gold'}]);
bot.music.skip();
} catch (e) {
throw new Error('No music is currently playing!');
}
}
if (args[0] === 'loop') {
} else if (args[0] === 'loop') {
if (args[1] === 'off') {
bot.music.loop = 0;
bot.tellraw('@a', [{text: 'Looping is now '}, {text: 'disabled', color: 'red'}]);
}
if (args[1] === 'current') {
} else if (args[1] === 'current') {
bot.music.loop = 1;
bot.tellraw('@a', [{text: 'Now Looping '}, {text: song.name, color: 'gold'}]);
}
if (args[1] === 'all') {
} else if (args[1] === 'all') {
bot.music.loop = 2;
bot.tellraw('@a', {text: 'Now looping every song in the queue'});
} else {
throw new SyntaxError('Invalid argument');
}
}
if (args[0] === 'list') {
} else if (args[0] === 'list') {
list(bot);
}
if (args[0] === 'nowplaying') {
} else if (args[0] === 'nowplaying') {
bot.tellraw('@a', [{text: 'Now playing '}, {text: bot.music.song.name, color: 'gold'}]);
} else {
throw new SyntaxError('Invalid argument');
}
},
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {

View file

@ -10,14 +10,14 @@ module.exports = {
execute: function(bot, username, usernameraw, sender, prefix, args) {
const timezone = args.join(' ');
const momented = moment().tz(`${timezone}`).format('dddd, MMMM Do, YYYY, hh:mm:ss A');
const command = 'minecraft:tellraw @a ' + JSON.stringify(['', {text: 'The current date and time for the timezone ', color: 'white'}, {text: timezone, color: 'aqua'}, {text: ' is: ', color: 'white'}, {text: `${momented}`, color: 'green'}]);
const component = [{text: 'The current date and time for the timezone ', color: 'white'}, {text: timezone, color: 'aqua'}, {text: ' is: ', color: 'white'}, {text: `${momented}`, color: 'green'}];
if (timezone.toLowerCase() === 'asia/bangkok' || timezone.toLowerCase() === 'utc') {
bot.core.run(command);
bot.tellraw('@a', component);
return;
} else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) {
throw new SyntaxError('Invalid timezone');
} else {
bot.core.run(command);
bot.tellraw('@a', component);
}
},
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {

View file

@ -10,7 +10,7 @@ module.exports = {
execute: async function(bot, username, usernameraw, sender, prefix, args) {
try {
const res = await translate(args.slice(2).join(' '), {from: args[0], to: args[1]});
bot.tellraw('@a', ['', {text: 'Result: ', color: 'gold'}, {text: res.text, color: 'green'}]);
bot.tellraw('@a', [{text: 'Result: ', color: 'gold'}, {text: res.text, color: 'green'}]);
} catch (e) {
bot.tellraw('@a', {text: String(e), color: 'red'});
}

View file

@ -8,7 +8,7 @@ module.exports = {
usage: '',
trusted: 0,
execute: function(bot) {
bot.tellraw('@a', ['', {text: 'The bot\'s uptime is ', color: 'white'}, {text: `${secondsToHms(Math.floor(performance.now() / 1000))}`, color: 'green'}]);
bot.tellraw('@a', [{text: 'The bot\'s uptime is ', color: 'white'}, {text: `${secondsToHms(Math.floor(performance.now() / 1000))}`, color: 'green'}]);
},
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
const Embed = new MessageEmbed()

View file

@ -9,11 +9,11 @@ module.exports = {
execute: function(bot, username, usernameraw, sender, prefix, args) {
urban.autocompleteExtra(args[0], (error, results) => {
if (error) {
bot.tellraw('@a', ['', {text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: error.message, color: 'red'}]);
bot.tellraw('@a', [{text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: error.message, color: 'red'}]);
return;
}
results.forEach(({preview, term}) => {
bot.tellraw('@a', ['', {text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: term, color: 'white'}, {text: ' - ', color: 'white'}, {text: preview, color: 'white'}]);
bot.tellraw('@a', [{text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: term, color: 'white'}, {text: ' - ', color: 'white'}, {text: preview, color: 'white'}]);
});
});
},

View file

@ -233,7 +233,7 @@ function main() {
crypto,
colorConvert,
bruhifyText: function(message) {
if (typeof message!=='string') throw new SyntaxError('message must be a string');
if (typeof message !== 'string') throw new SyntaxError('message must be a string');
bot.bruhifyText = message.substring(0, 1000);
},
generateEaglerUsername,
@ -259,7 +259,7 @@ function main() {
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 !== undefined) {
if (parsedMessage.extra[0].text === 'Command set: ') return;
}
// prevent braille cuz it CRASHES THE ENTIRE LAPTOP
@ -374,7 +374,7 @@ dcclient.on('ready', async () => {
}
if (line === '.kill') process.exit();
if (line.startsWith('.')) return bot.command_handler.run('Console', '§a§lConsole§r', '*' + line.substring(1), 'c0ns0le-uuid');
bot.tellraw('@a', ['', {'text': '[', 'color': 'dark_gray'}, {'text': `${bot.username} Console`, 'color': 'gray'}, {'text': '] ', 'color': 'dark_gray'}, {'text': 'chayapak ', 'color': 'green'}, {'text': ' ', 'color': 'dark_gray'}, chatMessage.MessageBuilder.fromString('&7' + line)]);
bot.tellraw('@a', [{'text': '[', 'color': 'dark_gray'}, {'text': `${bot.username} Console`, 'color': 'gray'}, {'text': '] ', 'color': 'dark_gray'}, {'text': 'chayapak ', 'color': 'green'}, {'text': ' ', 'color': 'dark_gray'}, chatMessage.MessageBuilder.fromString('&7' + line)]);
} catch (e) {
console.log(e);
}

View file

@ -54,7 +54,7 @@ function inject(bot, dcclient, config) {
});
const interval = setInterval(() => {
if (bot.options.host!=='0.tcp.ap.ngrok.io') {
if (bot.options.host !== '0.tcp.ap.ngrok.io') {
if (!prefix && config.self_care.prefix) bot.chat('/extras:prefix &8[&eChomeNS Bot&8]');
if (!op && config.self_care.op) bot.chat('/minecraft:op @s[type=player]');
if (!cspy && config.self_care.cspy) bot.chat('/commandspy:commandspy on');

View file

@ -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;
}

View file

@ -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;

View file

@ -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
}