mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
add selector
This commit is contained in:
parent
059f7bf6af
commit
e7d75fab44
42 changed files with 115 additions and 104 deletions
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Sudo everyone on Ayunboom!',
|
||||
trusted: 1,
|
||||
usage: '<hash> <c:|command>',
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
bot.core.run(`essentials:sudo * ${args.slice(1).join(' ')}`);
|
||||
} else {
|
||||
|
|
|
@ -6,8 +6,8 @@ module.exports = {
|
|||
description: 'Shows the bot\'s username and UUID',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
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'}]}}]);
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.tellraw(selector, [{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()
|
||||
|
|
|
@ -6,16 +6,16 @@ module.exports = {
|
|||
description: 'Changes the bot\'s visibility',
|
||||
usage: '<hash> <true|false>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
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(selector, [{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(selector, [{text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]);
|
||||
} else {
|
||||
throw new SyntaxError('Invalid argument');
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
description: 'RecycleBot bruhify but actionbar',
|
||||
usage: '<message>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.bruhifyText = args.join(' ');
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Executes a command in the command core',
|
||||
usage: '<command>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.core.run(args.join(' '));
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
|
@ -7,11 +7,11 @@ module.exports = {
|
|||
description: 'Shows the bot\'s changelog',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
bot.tellraw('@a', [{text: 'Changelogs:', color: 'green'}]);
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.tellraw(selector, [{text: 'Changelogs:', color: 'green'}]);
|
||||
changelog.forEach((message, number) => {
|
||||
number += 1;
|
||||
bot.tellraw('@a', [{text: `${number}`, color: 'gray'}, {text: ' - ', color: 'dark_gray'}, {text: message, color: 'gray'}]);
|
||||
bot.tellraw(selector, [{text: `${number}`, color: 'gray'}, {text: ' - ', color: 'dark_gray'}, {text: message, color: 'gray'}]);
|
||||
});
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
|
@ -6,12 +6,12 @@ module.exports = {
|
|||
description: 'Clears the chat',
|
||||
usage: '[specific] <player>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === 'specific') {
|
||||
bot.tellraw(args[1], [{text: `${'\n'.repeat(100)}`, color: 'white'}, {text: `Your chat has been cleared by ${username}.`, color: 'dark_green'}]);
|
||||
return;
|
||||
} else {
|
||||
bot.tellraw('@a', [{text: `${'\n'.repeat(100)}`, color: 'white'}, {text: 'The chat has been cleared.', color: 'dark_green'}]);
|
||||
bot.tellraw(selector, [{text: `${'\n'.repeat(100)}`, color: 'white'}, {text: 'The chat has been cleared.', color: 'dark_green'}]);
|
||||
}
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
bot.tellraw(args[1], [{text: `${'\n'.repeat(100)}`, color: 'white'}, {text: `Your chat has been cleared by ${username} (on Discord).`, color: 'dark_green'}]);
|
||||
return;
|
||||
} else {
|
||||
bot.tellraw('@a', [{text: `${'\n'.repeat(100)}`, color: 'white'}, {text: 'The chat has been cleared.', color: 'dark_green'}]);
|
||||
bot.tellraw(selector, [{text: `${'\n'.repeat(100)}`, color: 'white'}, {text: 'The chat has been cleared.', color: 'dark_green'}]);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
alias: ['ccq'],
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (bot.queue[0]) {
|
||||
bot.queue = [];
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ function list(bot, discord, channeldc) {
|
|||
|
||||
message.pop();
|
||||
|
||||
bot.tellraw('@a', message);
|
||||
bot.tellraw(selector, message);
|
||||
}
|
||||
module.exports = {
|
||||
name: 'cloop',
|
||||
|
@ -66,22 +66,22 @@ module.exports = {
|
|||
'<hash> <list>',
|
||||
],
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (!bot.cloops) bot.cloops = [];
|
||||
|
||||
if (args[0] === 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'}]);
|
||||
bot.tellraw(selector, [{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 if (args[1] === 'remove') {
|
||||
remove(args[2]);
|
||||
bot.tellraw('@a', [{text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]);
|
||||
bot.tellraw(selector, [{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(selector, [{text: 'Removed all looped commands', color: 'white'}]);
|
||||
} else {
|
||||
throw new SyntaxError('Invalid argument');
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
description: 'Moo',
|
||||
usage: '<cow|list> <message>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0]==='list') {
|
||||
const listed = Object.keys(cows);
|
||||
|
||||
|
@ -30,9 +30,9 @@ module.exports = {
|
|||
});
|
||||
});
|
||||
|
||||
bot.tellraw('@a', message);
|
||||
bot.tellraw(selector, message);
|
||||
} else {
|
||||
bot.tellraw('@a', {text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`});
|
||||
bot.tellraw(selector, {text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@ module.exports = {
|
|||
description: 'Crashes the server',
|
||||
usage: '<hash>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
crash(bot);
|
||||
} else {
|
||||
|
|
|
@ -6,8 +6,8 @@ module.exports = {
|
|||
description: 'Shows the bot\'s creator',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
bot.tellraw('@a', [{text: 'ChomeNS Bot ', color: 'yellow'}, {text: 'was created by ', color: 'white'}, {text: 'chayapak', color: 'gold'}]);
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.tellraw(selector, [{text: 'ChomeNS Bot ', color: 'yellow'}, {text: 'was created by ', color: 'white'}, {text: 'chayapak', color: 'gold'}]);
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
const Embed = new MessageEmbed()
|
||||
|
|
|
@ -4,8 +4,8 @@ module.exports = {
|
|||
description: 'Shows the discord invite',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
bot.tellraw('@a', [
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.tellraw(selector, [
|
||||
{
|
||||
text: 'The Discord invite is ',
|
||||
color: 'white',
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = {
|
|||
|
||||
bot.draw(data, info);
|
||||
} catch (e) {
|
||||
bot.tellraw('@a', {text: 'SyntaxError: Invalid URL', color: 'red'});
|
||||
bot.tellraw(selector, {text: 'SyntaxError: Invalid URL', color: 'red'});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Lags Eaglercraft and crashes it',
|
||||
usage: '<on|off> <hash>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[1] === 'on') {
|
||||
if (args[0] === hash) {
|
||||
bot.eaglercrashstarted = true;
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Says a message',
|
||||
usage: '<message>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.chat(args.join(' '));
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Ends the bot\'s client',
|
||||
usage: '<hash>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
bot.end('end command');
|
||||
} else {
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Summon any entity!',
|
||||
usage: '[specific] <player>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const mcData = require('minecraft-data')(bot.version);
|
||||
|
||||
|
@ -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(selector, [{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(selector, [{text: `Entity `, color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}]);
|
||||
// }
|
||||
},
|
||||
};
|
||||
|
|
|
@ -15,12 +15,12 @@ module.exports = {
|
|||
'<reset>',
|
||||
'<server (eval server)> <code>',
|
||||
],
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === 'run') {
|
||||
try {
|
||||
bot.tellraw('@a', {text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)});
|
||||
bot.tellraw(selector, {text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)});
|
||||
} catch (err) {
|
||||
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
bot.tellraw(selector, {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
}
|
||||
}
|
||||
if (args[0] === 'reset') {
|
||||
|
@ -34,9 +34,9 @@ module.exports = {
|
|||
colors: 'minecraft',
|
||||
code: args[1],
|
||||
})).then((res) => {
|
||||
bot.tellraw('@a', {text: `${res.data}`});
|
||||
bot.tellraw(selector, {text: `${res.data}`});
|
||||
}).catch((err) => {
|
||||
bot.tellraw('@a', {text: `${err}`, color: 'red'});
|
||||
bot.tellraw(selector, {text: `${err}`, color: 'red'});
|
||||
});
|
||||
}
|
||||
// if (args[0] === 'dineval') {
|
||||
|
@ -47,9 +47,9 @@ module.exports = {
|
|||
// colors: 'minecraft',
|
||||
// },
|
||||
// }).then((res) => {
|
||||
// bot.tellraw('@a', {text: `${res.data}`}));
|
||||
// bot.tellraw(selector, {text: `${res.data}`}));
|
||||
// }).catch((e) => {
|
||||
// bot.tellraw('@a', {text: `${e}`, color: 'red'});
|
||||
// bot.tellraw(selector, {text: `${e}`, color: 'red'});
|
||||
// });
|
||||
// }
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Execute command bypassed',
|
||||
usage: '<hash> <command>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
bot.core.run('minecraft:execute unless entity @s[name= run ] run ' + args.slice(1).join(' '));
|
||||
} else {
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Gamemode everyone',
|
||||
usage: '<hash> <gamemode>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
bot.core.run(`minecraft:execute unless entity @s[name= run ] run gamemode ${args[1]} @a[name=!${bot.username}]`);
|
||||
} else {
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
|||
description: 'Shows the help',
|
||||
usage: '[command]',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
const generalCommands = [];
|
||||
const trustedCommands = [];
|
||||
const ownerCommands = [];
|
||||
|
@ -68,10 +68,10 @@ module.exports = {
|
|||
usage.pop();
|
||||
}
|
||||
|
||||
bot.tellraw('@a', [{text: prefix + command.name, color: 'gold'}, {text: ` (${alias})`, color: 'white'}, {text: ' - ', color: 'gray'}, {text: command.description, color: 'gray'}]);
|
||||
bot.tellraw('@a', [{text: 'Trust level: ', color: 'green'}, {text: command.trusted, color: 'yellow'}]);
|
||||
bot.tellraw('@a', [{text: 'Supported on Discord: ', color: 'green'}, {text: discordSupported, color: 'gold'}]);
|
||||
bot.tellraw('@a', usage);
|
||||
bot.tellraw(selector, [{text: prefix + command.name, color: 'gold'}, {text: ` (${alias})`, color: 'white'}, {text: ' - ', color: 'gray'}, {text: command.description, color: 'gray'}]);
|
||||
bot.tellraw(selector, [{text: 'Trust level: ', color: 'green'}, {text: command.trusted, color: 'yellow'}]);
|
||||
bot.tellraw(selector, [{text: 'Supported on Discord: ', color: 'green'}, {text: discordSupported, color: 'gold'}]);
|
||||
bot.tellraw(selector, usage);
|
||||
}
|
||||
|
||||
if (command.name === args[0]) run();
|
||||
|
@ -81,7 +81,7 @@ module.exports = {
|
|||
};
|
||||
} else {
|
||||
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, generalCommands, trustedCommands, ownerCommands]);
|
||||
bot.tellraw(selector, [pre, generalCommands, trustedCommands, ownerCommands]);
|
||||
}
|
||||
},
|
||||
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
|
@ -53,7 +53,7 @@ module.exports = {
|
|||
component.push('\n');
|
||||
}
|
||||
component.pop();
|
||||
bot.tellraw('@a', component);
|
||||
bot.tellraw(selector, component);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable require-jsdoc */
|
||||
/* eslint-disable max-len */
|
||||
const fs = require('fs/promises');
|
||||
const {MessageEmbed} = require('discord.js');
|
||||
|
@ -15,7 +16,7 @@ if (os.hostname() === 'chomens-kubuntu') {
|
|||
SONGS_PATH = path.join(__dirname, '..', 'midis');
|
||||
}
|
||||
|
||||
async function play(bot, values, discord, channeldc) {
|
||||
async function play(bot, values, discord, channeldc, selector) {
|
||||
try {
|
||||
const filepath = values.join(' ');
|
||||
const absolutePath = await resolve(filepath);
|
||||
|
@ -29,7 +30,7 @@ async function play(bot, values, discord, channeldc) {
|
|||
.setDescription(`Added ${song.name} to the song queue`);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.tellraw('@a', [{text: 'Added ', color: 'white'}, {text: song.name, color: 'gold'}, {text: ' to the song queue', color: 'white'}]);
|
||||
bot.tellraw(selector, [{text: 'Added ', color: 'white'}, {text: song.name, color: 'gold'}, {text: ' to the song queue', color: 'white'}]);
|
||||
}
|
||||
} catch (e) {
|
||||
if (discord) {
|
||||
|
@ -39,12 +40,12 @@ async function play(bot, values, discord, channeldc) {
|
|||
.setDescription(`\`\`\`SyntaxError: Invalid file\`\`\``);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.tellraw('@a', {text: 'SyntaxError: Invalid file', color: 'red'});
|
||||
bot.tellraw(selector, {text: 'SyntaxError: Invalid file', color: 'red'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function playUrl(bot, values, discord, channeldc) {
|
||||
async function playUrl(bot, values, discord, channeldc, selector) {
|
||||
try {
|
||||
const url = values.join(' ');
|
||||
const response = await axios.get('https://http-proxy.nongsonchome.repl.co', {
|
||||
|
@ -63,7 +64,7 @@ async function playUrl(bot, values, discord, channeldc) {
|
|||
.setDescription(`Added ${song.name} to the song queue`);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.tellraw('@a', [{text: 'Added ', color: 'white'}, {text: song.name, color: 'gold'}, {text: ' to the song queue', color: 'white'}]);
|
||||
bot.tellraw(selector, [{text: 'Added ', color: 'white'}, {text: song.name, color: 'gold'}, {text: ' to the song queue', color: 'white'}]);
|
||||
}
|
||||
} catch (e) {
|
||||
if (discord) {
|
||||
|
@ -73,7 +74,7 @@ async function playUrl(bot, values, discord, channeldc) {
|
|||
.setDescription(`\`\`\`SyntaxError: Invalid URL\`\`\``);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.tellraw('@a', {text: 'SyntaxError: Invalid URL', color: 'red'});
|
||||
bot.tellraw(selector, {text: 'SyntaxError: Invalid URL', color: 'red'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +86,7 @@ async function resolve(filepath) {
|
|||
return filepath;
|
||||
}
|
||||
|
||||
async function list(bot, discord, channeldc, prefix) {
|
||||
async function list(bot, discord, channeldc, prefix, selector) {
|
||||
const absolutePath = await resolve(SONGS_PATH);
|
||||
const listed = await fileList(absolutePath);
|
||||
|
||||
|
@ -125,7 +126,7 @@ async function list(bot, discord, channeldc, prefix) {
|
|||
}});
|
||||
});
|
||||
|
||||
bot.tellraw('@a', message);
|
||||
bot.tellraw(selector, message);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -143,17 +144,17 @@ module.exports = {
|
|||
'<nowplaying>',
|
||||
'<queue>',
|
||||
],
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
switch (args[0]) {
|
||||
case 'play':
|
||||
play(bot, args.slice(1));
|
||||
play(bot, args.slice(1), false, null, selector);
|
||||
break;
|
||||
case 'playurl':
|
||||
playUrl(bot, args.slice(1));
|
||||
playUrl(bot, args.slice(1), false, null, selector);
|
||||
break;
|
||||
case 'stop':
|
||||
try {
|
||||
bot.tellraw('@a', {text: 'Cleared the song queue'});
|
||||
bot.tellraw(selector, {text: 'Cleared the song queue'});
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
@ -161,7 +162,7 @@ module.exports = {
|
|||
break;
|
||||
case 'skip':
|
||||
try {
|
||||
bot.tellraw('@a', [{text: 'Skipping '}, {text: bot.music.song.name, color: 'gold'}]);
|
||||
bot.tellraw(selector, [{text: 'Skipping '}, {text: bot.music.song.name, color: 'gold'}]);
|
||||
bot.music.skip();
|
||||
} catch (e) {
|
||||
throw new Error('No music is currently playing!');
|
||||
|
@ -171,7 +172,7 @@ module.exports = {
|
|||
switch (args[1]) {
|
||||
case 'off':
|
||||
bot.music.loop = 0;
|
||||
bot.tellraw('@a', [
|
||||
bot.tellraw(selector, [
|
||||
{
|
||||
text: 'Looping is now ',
|
||||
},
|
||||
|
@ -183,7 +184,7 @@ module.exports = {
|
|||
break;
|
||||
case 'current':
|
||||
bot.music.loop = 1;
|
||||
bot.tellraw('@a', [
|
||||
bot.tellraw(selector, [
|
||||
{
|
||||
text: 'Now Looping ',
|
||||
},
|
||||
|
@ -195,7 +196,7 @@ module.exports = {
|
|||
break;
|
||||
case 'all':
|
||||
bot.music.loop = 2;
|
||||
bot.tellraw('@a', {
|
||||
bot.tellraw(selector, {
|
||||
text: 'Now looping every song in the queue',
|
||||
});
|
||||
break;
|
||||
|
@ -204,10 +205,10 @@ module.exports = {
|
|||
}
|
||||
break;
|
||||
case 'list':
|
||||
list(bot, false, null, prefix);
|
||||
list(bot, false, null, prefix, selector);
|
||||
break;
|
||||
case 'nowplaying':
|
||||
bot.tellraw('@a', [
|
||||
bot.tellraw(selector, [
|
||||
{
|
||||
text: 'Now playing ',
|
||||
},
|
||||
|
@ -220,7 +221,7 @@ module.exports = {
|
|||
case 'queue':
|
||||
const queueWithName = [];
|
||||
bot.music.queue.forEach((song) => queueWithName.push(song.name));
|
||||
bot.tellraw('@a', [
|
||||
bot.tellraw(selector, [
|
||||
{
|
||||
text: 'Queue: ',
|
||||
color: 'green',
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Broadcasts a message to all of the servers that the bot is connected',
|
||||
usage: '<message>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
const component = [
|
||||
{
|
||||
text: '[',
|
||||
|
@ -39,7 +39,7 @@ module.exports = {
|
|||
|
||||
const bots = bot.getBots();
|
||||
bots.forEach((bot) => {
|
||||
bot.tellraw('@a', component);
|
||||
bot.tellraw(selector, component);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
description: 'Resets the bot\'s command core',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.core.loopPlace();
|
||||
},
|
||||
discordExecute: function(bot) {
|
||||
|
|
|
@ -6,9 +6,9 @@ module.exports = {
|
|||
description: 'Randomly teleports the player',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
const rtppos = `${between(20000000, 500000)} 100 ${between(20000000, 500000)}`;
|
||||
bot.tellraw('@a', [{text: 'Teleporting ', color: 'white'}, {text: username, color: 'aqua'}, {text: ' to ', color: 'white'}, {text: rtppos, color: 'green'}, {text: '...', color: 'white'}]);
|
||||
bot.tellraw(selector, [{text: 'Teleporting ', color: 'white'}, {text: username, color: 'aqua'}, {text: ' to ', color: 'white'}, {text: rtppos, color: 'green'}, {text: '...', color: 'white'}]);
|
||||
bot.core.run(`essentials:teleport ${sender} ${rtppos}`);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -7,12 +7,12 @@ module.exports = {
|
|||
description: 'Eval command without vm2',
|
||||
trusted: 2,
|
||||
usage: '<ownerhash> <code>',
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === ownerhash) {
|
||||
try {
|
||||
bot.tellraw('@a', {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)});
|
||||
bot.tellraw(selector, {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 32000)});
|
||||
} catch (err) {
|
||||
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
bot.tellraw(selector, {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
}
|
||||
} else {
|
||||
throw new Error('Invalid OwnerHash');
|
||||
|
|
|
@ -6,8 +6,8 @@ module.exports = {
|
|||
description: 'Tests if the bot is working',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
bot.tellraw('@a', [
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.tellraw(selector, [
|
||||
{
|
||||
text: `Username: ${username},`,
|
||||
color: 'green',
|
||||
|
|
|
@ -7,17 +7,17 @@ module.exports = {
|
|||
description: 'Shows the time',
|
||||
usage: '<timezone>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
const timezone = args.join(' ');
|
||||
const momented = moment().tz(`${timezone}`).format('dddd, MMMM Do, YYYY, hh:mm:ss A');
|
||||
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.tellraw('@a', component);
|
||||
bot.tellraw(selector, component);
|
||||
return;
|
||||
} else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) {
|
||||
throw new SyntaxError('Invalid timezone');
|
||||
} else {
|
||||
bot.tellraw('@a', component);
|
||||
bot.tellraw(selector, component);
|
||||
}
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
description: 'Teleport everyone',
|
||||
usage: '<hash> <player>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
bot.core.run(`minecraft:execute unless entity @s[name= run ] run tp @a ${args.slice(1).join(' ')}`);
|
||||
} else {
|
||||
|
|
|
@ -10,9 +10,9 @@ 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(selector, [{text: 'Result: ', color: 'gold'}, {text: res.text, color: 'green'}]);
|
||||
} catch (e) {
|
||||
bot.tellraw('@a', {text: String(e), color: 'red'});
|
||||
bot.tellraw(selector, {text: String(e), color: 'red'});
|
||||
}
|
||||
},
|
||||
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
|
|
|
@ -7,8 +7,8 @@ module.exports = {
|
|||
description: 'Shows the bot\'s uptime',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
bot.tellraw('@a', [{text: 'The bot\'s uptime is ', color: 'white'}, {text: `${secondsToHms(Math.floor(performance.now() / 1000))}`, color: 'green'}]);
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
bot.tellraw(selector, [{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()
|
||||
|
|
|
@ -6,14 +6,14 @@ module.exports = {
|
|||
description: 'Working Urban Dictionary',
|
||||
usage: '<word>',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
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(selector, [{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(selector, [{text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: term, color: 'white'}, {text: ' - ', color: 'white'}, {text: preview, color: 'white'}]);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -6,12 +6,12 @@ module.exports = {
|
|||
description: 'Gets the UUID of a player. If no player specified it will show your UUID instead',
|
||||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0]) {
|
||||
const playername = args.join(' ');
|
||||
const player = bot.playersAddedPlayers[playername];
|
||||
if (player === undefined) throw new SyntaxError('Invalid Username');
|
||||
bot.tellraw('@a',
|
||||
bot.tellraw(selector,
|
||||
[
|
||||
{
|
||||
text: `${playername}'s UUID: `,
|
||||
|
@ -36,7 +36,7 @@ module.exports = {
|
|||
},
|
||||
]);
|
||||
} else {
|
||||
bot.tellraw('@a',
|
||||
bot.tellraw(selector,
|
||||
[
|
||||
{
|
||||
text: `Your UUID: `,
|
||||
|
|
|
@ -5,13 +5,13 @@ module.exports = {
|
|||
alias: [],
|
||||
usage: '<hash>',
|
||||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash) {
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||
if (args[0] === hash) {
|
||||
bot.tellraw('@a', {text: 'Valid hash', color: 'green'});
|
||||
bot.tellraw(selector, {text: 'Valid hash', color: 'green'});
|
||||
} else if (args[0] === ownerhash) {
|
||||
bot.tellraw('@a', {text: 'Valid OwnerHash', color: 'green'});
|
||||
bot.tellraw(selector, {text: 'Valid OwnerHash', color: 'green'});
|
||||
} else {
|
||||
bot.tellraw('@a', {text: 'Invalid hash', color: 'red'});
|
||||
bot.tellraw(selector, {text: 'Invalid hash', color: 'red'});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -12,9 +12,9 @@ module.exports = {
|
|||
try {
|
||||
const page = await wiki.page(args.join(' '));
|
||||
const summary = await page.summary();
|
||||
bot.tellraw('@a', {text: summary.extract, color: 'green'});
|
||||
bot.tellraw(selector, {text: summary.extract, color: 'green'});
|
||||
} catch (e) {
|
||||
bot.tellraw('@a', {text: e.toString(), color: 'red'});
|
||||
bot.tellraw(selector, {text: e.toString(), color: 'red'});
|
||||
}
|
||||
},
|
||||
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
|
@ -11,7 +11,7 @@ function inject(bot, dcclient, config) {
|
|||
bot.command_handler.commands = loadFiles(path.join(__dirname, config.commandsDir));
|
||||
};
|
||||
bot.command_handler.reload();
|
||||
bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc, hash, ownerhash) {
|
||||
bot.command_handler.main = function(prefix, username, usernameraw, message, sender, channeldc, hash, ownerhash, selector) {
|
||||
bot.command_handler.reload();
|
||||
let raw;
|
||||
let command;
|
||||
|
@ -28,7 +28,7 @@ function inject(bot, dcclient, config) {
|
|||
if (typeof command.discordExecute === 'undefined') throw new Error('This command is not yet supported on discord!');
|
||||
command.discordExecute(bot, username, usernameraw, sender, prefix, args, channeldc, message, config);
|
||||
} else {
|
||||
command.execute(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash);
|
||||
command.execute(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector);
|
||||
}
|
||||
} catch (e) {
|
||||
if (prefix === config.discord.prefix) {
|
||||
|
@ -42,10 +42,10 @@ function inject(bot, dcclient, config) {
|
|||
}
|
||||
}
|
||||
};
|
||||
bot.command_handler.run = function(username, usernameraw, message, sender, channeldc, hash, ownerhash) {
|
||||
bot.command_handler.run = function(username, usernameraw, message, sender, channeldc, hash, ownerhash, selector = '@a') {
|
||||
for (const prefix of config.prefixes) {
|
||||
if (!message.startsWith(prefix)) continue;
|
||||
bot.command_handler.main(prefix, username, usernameraw, message, sender, channeldc, hash, ownerhash);
|
||||
bot.command_handler.main(prefix, username, usernameraw, message, sender, channeldc, hash, ownerhash, selector);
|
||||
}
|
||||
};
|
||||
bot.on('message', async (_username, _message, _sender) => {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable require-jsdoc */
|
||||
/* eslint-disable max-len */
|
||||
const {escapeMarkdown} = require('../util/escapeMarkdown');
|
||||
async function inject(bot, dcclient, config, rl) {
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
/* eslint-disable max-len */
|
||||
const convert = require('color-convert');
|
||||
|
||||
// eslint-disable-next-line require-jsdoc
|
||||
function inject(bot) {
|
||||
/**
|
||||
* draw which is totallynotskidded from ybot
|
||||
* @param {buffer} data data buffer
|
||||
* @param {*} info idk bout this
|
||||
* @param {object} prefix prefix in the output compoenent
|
||||
*/
|
||||
function draw(data, info, prefix = {}) {
|
||||
const pixels = [];
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable require-jsdoc */
|
||||
/* eslint-disable max-len */
|
||||
const {Midi} = require('@tonejs/midi');
|
||||
const {convertMidi} = require('../util/midi_converter');
|
||||
|
|
|
@ -62,6 +62,7 @@ function inject(bot, dcclient, config) {
|
|||
null,
|
||||
'h',
|
||||
'o',
|
||||
client.username,
|
||||
);
|
||||
}
|
||||
bot.tellraw('@a', {
|
||||
|
|
Loading…
Reference in a new issue