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: '', usage: '',
trusted: 0, trusted: 0,
execute: function(bot) { 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) { discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
const Embed = new MessageEmbed() const Embed = new MessageEmbed()

View file

@ -11,11 +11,11 @@ module.exports = {
if (args[1] === 'true') { if (args[1] === 'true') {
bot.visibility = true; bot.visibility = true;
bot.chat('/essentials:vanish disable'); 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') { } else if (args[1] === 'false') {
bot.visibility = false; bot.visibility = false;
bot.chat('/essentials:vanish enable'); 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 { } else {
throw new SyntaxError('Invalid argument'); throw new SyntaxError('Invalid argument');
} }

View file

@ -63,51 +63,31 @@ module.exports = {
execute: function(bot, username, usernameraw, sender, prefix, args) { execute: function(bot, username, usernameraw, sender, prefix, args) {
if (!bot.cloops) bot.cloops = []; if (!bot.cloops) bot.cloops = [];
if (args[1] === 'add') {
if (args[0] === bot.hash) { if (args[0] === bot.hash) {
if (args[3]) { if (args[1] === 'add' && args[3]) {
if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval'); if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval');
add(args.slice(3).join(' '), args[2], bot); 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'}]); 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') {
} else {
throw new Error('Invalid hash');
}
return;
}
if (args[1] === 'list') {
if (args[0] === bot.hash) {
list(bot); list(bot);
} else { } else if (args[1] === 'remove') {
throw new Error('Invalid hash');
}
return;
}
if (args[1] === 'remove') {
if (args[0] === bot.hash) {
remove(args[2]); remove(args[2]);
bot.tellraw('@a', ['', {text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]); bot.tellraw('@a', [{text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]);
} else { } else if (args[1] === 'removeall') {
throw new Error('Invalid hash');
}
return;
}
if (args[1] === 'removeall') {
if (args[0] === bot.hash) {
clear(); clear();
bot.tellraw('@a', ['', {text: 'Removed all looped commands', color: 'white'}]); bot.tellraw('@a', [{text: 'Removed all looped commands', color: 'white'}]);
} else {
throw new SyntaxError('Invalid argument');
}
} else { } else {
throw new Error('Invalid hash'); throw new Error('Invalid hash');
} }
return;
}
}, },
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) { discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
if (!bot.cloops) bot.cloops = []; if (!bot.cloops) bot.cloops = [];
if (args[0] === 'add') {
if (message.member.roles.cache.some((role) => role.name === 'Trusted')) { if (message.member.roles.cache.some((role) => role.name === 'Trusted')) {
if (args[2]) { if (args[0] === 'add' && args[2]) {
if (!Number(args[1]) && Number(args[1]) !== 0) throw new SyntaxError('Invalid interval'); if (!Number(args[1]) && Number(args[1]) !== 0) throw new SyntaxError('Invalid interval');
add(args.slice(2).join(' '), args[1], bot); add(args.slice(2).join(' '), args[1], bot);
const Embed = new MessageEmbed() const Embed = new MessageEmbed()
@ -115,35 +95,16 @@ module.exports = {
.setTitle('Cloop') .setTitle('Cloop')
.setDescription(`Added cloop \`${args.slice(2).join(' ')}\` with interval ${args[1]} to the cloops`); .setDescription(`Added cloop \`${args.slice(2).join(' ')}\` with interval ${args[1]} to the cloops`);
channeldc.send({embeds: [Embed]}); channeldc.send({embeds: [Embed]});
} } else if (args[0] === 'list') {
} 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')) {
list(bot, true, channeldc); list(bot, true, channeldc);
} else { } else if (args[0] === 'remove') {
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')) {
remove(args[1]); remove(args[1]);
const Embed = new MessageEmbed() const Embed = new MessageEmbed()
.setColor('#FFFF00') .setColor('#FFFF00')
.setTitle('Cloop') .setTitle('Cloop')
.setDescription(`Removed cloop \`${args[1]}\``); .setDescription(`Removed cloop \`${args[1]}\``);
channeldc.send({embeds: [Embed]}); channeldc.send({embeds: [Embed]});
} else { } else if (args[0] === 'removeall') {
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')) {
clear(); clear();
const Embed = new MessageEmbed() const Embed = new MessageEmbed()
.setColor('#FFFF00') .setColor('#FFFF00')
@ -151,9 +112,10 @@ module.exports = {
.setDescription('Removed all looped commands'); .setDescription('Removed all looped commands');
channeldc.send({embeds: [Embed]}); channeldc.send({embeds: [Embed]});
} else { } 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>', usage: '<cow|list> <message>',
trusted: 0, trusted: 0,
execute: function(bot, username, usernameraw, sender, prefix, args) { execute: function(bot, username, usernameraw, sender, prefix, args) {
if (args[0]!=='list') { if (args[0]==='list') {
bot.tellraw('@a', {text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`});
} else {
let color = '§6'; let color = '§6';
let message = ''; let message = '';
@ -23,6 +21,8 @@ module.exports = {
message += color + value + ' '; message += color + value + ' ';
}); });
bot.tellraw('@a', [{text: 'Cows: ', color: 'green'}, '\n', {text: message, color: 'red'}]); 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 (!entity) throw new SyntaxError('Invalid entity');
// if (!args[1]) { // 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.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]) { // } 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.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) { } catch (err) {
throw err; throw err;
} }
} } else if (args[0] === 'reset') {
if (args[0] === 'reset') {
bot.vm = new VM(bot.vmoptions); bot.vm = new VM(bot.vmoptions);
} } else if (args[0] === 'server') {
if (args[0] === 'server') {
axios axios
.post(config.eval.serverUrl, querystring.stringify({ .post(config.eval.serverUrl, querystring.stringify({
html: false, html: false,
@ -79,6 +77,8 @@ module.exports = {
}).catch((err) => { }).catch((err) => {
throw err; throw err;
}); });
} else {
throw new SyntaxError('Invalid argument');
} }
}, },
}; };

View file

@ -9,11 +9,11 @@ module.exports = {
trusted: 0, trusted: 0,
execute: async function(bot) { execute: async function(bot) {
try { try {
bot.tellraw('@a', ['', {text: 'Players:', color: 'green'}]); bot.tellraw('@a', [{text: 'Players:', color: 'green'}]);
await sleep(60); await sleep(60);
for (const property of bot.players.list) { for (const property of bot.players.list) {
// if (property.match.startsWith('@')) continue; // 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) { } catch (e) {
return; return;

View file

@ -136,45 +136,41 @@ module.exports = {
execute: function(bot, username, usernameraw, sender, prefix, args) { execute: function(bot, username, usernameraw, sender, prefix, args) {
if (args[0] === 'play') { if (args[0] === 'play') {
play(bot, args.slice(1)); play(bot, args.slice(1));
} } else if (args[0] === 'playurl') {
if (args[0] === 'playurl') {
playUrl(bot, args.slice(1)); playUrl(bot, args.slice(1));
} } else if (args[0] === 'stop') {
if (args[0] === 'stop') {
try { try {
bot.tellraw('@a', {text: 'Cleared the song queue'}); bot.tellraw('@a', {text: 'Cleared the song queue'});
} catch (e) { } catch (e) {
return; return;
} }
bot.music.stop(); bot.music.stop();
} } else if (args[0] === 'skip') {
if (args[0] === 'skip') {
try { try {
bot.tellraw('@a', [{text: 'Skipping '}, {text: bot.music.song.name, color: 'gold'}]); bot.tellraw('@a', [{text: 'Skipping '}, {text: bot.music.song.name, color: 'gold'}]);
bot.music.skip(); bot.music.skip();
} catch (e) { } catch (e) {
throw new Error('No music is currently playing!'); throw new Error('No music is currently playing!');
} }
} } else if (args[0] === 'loop') {
if (args[0] === 'loop') {
if (args[1] === 'off') { if (args[1] === 'off') {
bot.music.loop = 0; bot.music.loop = 0;
bot.tellraw('@a', [{text: 'Looping is now '}, {text: 'disabled', color: 'red'}]); bot.tellraw('@a', [{text: 'Looping is now '}, {text: 'disabled', color: 'red'}]);
} } else if (args[1] === 'current') {
if (args[1] === 'current') {
bot.music.loop = 1; bot.music.loop = 1;
bot.tellraw('@a', [{text: 'Now Looping '}, {text: song.name, color: 'gold'}]); bot.tellraw('@a', [{text: 'Now Looping '}, {text: song.name, color: 'gold'}]);
} } else if (args[1] === 'all') {
if (args[1] === 'all') {
bot.music.loop = 2; bot.music.loop = 2;
bot.tellraw('@a', {text: 'Now looping every song in the queue'}); bot.tellraw('@a', {text: 'Now looping every song in the queue'});
} else {
throw new SyntaxError('Invalid argument');
} }
} } else if (args[0] === 'list') {
if (args[0] === 'list') {
list(bot); list(bot);
} } else if (args[0] === 'nowplaying') {
if (args[0] === 'nowplaying') {
bot.tellraw('@a', [{text: 'Now playing '}, {text: bot.music.song.name, color: 'gold'}]); 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) { 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) { execute: function(bot, username, usernameraw, sender, prefix, args) {
const timezone = args.join(' '); const timezone = args.join(' ');
const momented = moment().tz(`${timezone}`).format('dddd, MMMM Do, YYYY, hh:mm:ss A'); 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') { if (timezone.toLowerCase() === 'asia/bangkok' || timezone.toLowerCase() === 'utc') {
bot.core.run(command); bot.tellraw('@a', component);
return; return;
} else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) { } else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) {
throw new SyntaxError('Invalid timezone'); throw new SyntaxError('Invalid timezone');
} else { } else {
bot.core.run(command); bot.tellraw('@a', component);
} }
}, },
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) { 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) { execute: async function(bot, username, usernameraw, sender, prefix, args) {
try { try {
const res = await translate(args.slice(2).join(' '), {from: args[0], to: args[1]}); 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) { } catch (e) {
bot.tellraw('@a', {text: String(e), color: 'red'}); bot.tellraw('@a', {text: String(e), color: 'red'});
} }

View file

@ -8,7 +8,7 @@ module.exports = {
usage: '', usage: '',
trusted: 0, trusted: 0,
execute: function(bot) { 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) { discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
const Embed = new MessageEmbed() const Embed = new MessageEmbed()

View file

@ -9,11 +9,11 @@ module.exports = {
execute: function(bot, username, usernameraw, sender, prefix, args) { execute: function(bot, username, usernameraw, sender, prefix, args) {
urban.autocompleteExtra(args[0], (error, results) => { urban.autocompleteExtra(args[0], (error, results) => {
if (error) { 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; return;
} }
results.forEach(({preview, term}) => { 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

@ -374,7 +374,7 @@ dcclient.on('ready', async () => {
} }
if (line === '.kill') process.exit(); if (line === '.kill') process.exit();
if (line.startsWith('.')) return bot.command_handler.run('Console', '§a§lConsole§r', '*' + line.substring(1), 'c0ns0le-uuid'); 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) { } catch (e) {
console.log(e); console.log(e);
} }