mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
reaaaa
This commit is contained in:
parent
0ec4a8a3ef
commit
c972240c28
3 changed files with 56 additions and 28 deletions
|
@ -9,18 +9,28 @@ module.exports = {
|
|||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
if (args[0]==='list') {
|
||||
let color = '§6';
|
||||
let message = '';
|
||||
const listed = Object.keys(cows);
|
||||
|
||||
Object.keys(cows).forEach((value) => {
|
||||
if (color === '§6') {
|
||||
color = '§e';
|
||||
} else if (color === '§e') {
|
||||
color = '§6';
|
||||
let color = 'gold';
|
||||
const message = [];
|
||||
|
||||
listed.forEach((value) => {
|
||||
if (color === 'gold') {
|
||||
color = 'yellow';
|
||||
} else if (color === 'yellow') {
|
||||
color = 'gold';
|
||||
};
|
||||
message += color + value + ' ';
|
||||
message.push({
|
||||
text: value + ' ',
|
||||
color,
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `${prefix}cowsay ${value} `,
|
||||
},
|
||||
});
|
||||
});
|
||||
bot.tellraw('@a', [{text: 'Cows: ', color: 'green'}, '\n', {text: message, color: 'red'}]);
|
||||
|
||||
bot.tellraw('@a', message);
|
||||
} else {
|
||||
bot.tellraw('@a', {text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`});
|
||||
}
|
||||
|
|
|
@ -8,24 +8,41 @@ module.exports = {
|
|||
usage: '[command]',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
let generalCommands = '';
|
||||
let trustedCommands = '';
|
||||
let ownerCommands = '';
|
||||
const generalCommands = [];
|
||||
const trustedCommands = [];
|
||||
const ownerCommands = [];
|
||||
function component(command, color) {
|
||||
return {
|
||||
text: command.name + ' ',
|
||||
color,
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'Click here to see the information for this command',
|
||||
color: 'green',
|
||||
}],
|
||||
},
|
||||
clickEvent: {
|
||||
action: 'run_command',
|
||||
value: `${prefix}help ${command.name}`,
|
||||
},
|
||||
};
|
||||
};
|
||||
for (const command of bot.command_handler.commands) {
|
||||
if (command.trusted !== 0) continue;
|
||||
generalCommands += ' ' + command.name;
|
||||
generalCommands.push(component(command, 'green'));
|
||||
}
|
||||
for (const command of bot.command_handler.commands) {
|
||||
if (command.trusted !== 1) continue;
|
||||
trustedCommands += ' ' + command.name;
|
||||
trustedCommands.push(component(command, 'red'));
|
||||
}
|
||||
for (const command of bot.command_handler.commands) {
|
||||
if (command.trusted !== 2) continue;
|
||||
ownerCommands += ' ' + command.name;
|
||||
ownerCommands.push(component(command, 'dark_red'));
|
||||
}
|
||||
if (typeof args[0] !== 'undefined') {
|
||||
for (const command of bot.command_handler.commands) {
|
||||
function m() {
|
||||
function run() {
|
||||
let discordSupported;
|
||||
let alias = command.name;
|
||||
if (typeof command.discordExecute === 'undefined') {
|
||||
|
@ -42,20 +59,20 @@ 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]) run();
|
||||
for (const alias of command.alias) {
|
||||
if (alias === args[0]) m();
|
||||
if (alias === args[0]) run();
|
||||
}
|
||||
};
|
||||
} 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, {text: generalCommands, color: 'green'}, {text: trustedCommands, color: 'red'}, {text: ownerCommands, color: 'dark_red'}]);
|
||||
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]);
|
||||
}
|
||||
},
|
||||
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
if (typeof args[0] !== 'undefined') {
|
||||
for (const command of bot.command_handler.commands) {
|
||||
function m() {
|
||||
function run() {
|
||||
let discordSupported;
|
||||
let alias = command.name;
|
||||
if (typeof command.discordExecute === 'undefined') {
|
||||
|
@ -76,9 +93,9 @@ module.exports = {
|
|||
channeldc.send({embeds: [Embed]});
|
||||
}
|
||||
|
||||
if (command.name === args[0]) m();
|
||||
if (command.name === args[0]) run();
|
||||
for (const alias of command.alias) {
|
||||
if (alias === args[0]) m();
|
||||
if (alias === args[0]) run();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
|
|
@ -85,7 +85,7 @@ async function resolve(filepath) {
|
|||
return filepath;
|
||||
}
|
||||
|
||||
async function list(bot, discord, channeldc) {
|
||||
async function list(bot, discord, channeldc, prefix) {
|
||||
const absolutePath = await resolve(SONGS_PATH);
|
||||
const listed = await fileList(absolutePath);
|
||||
|
||||
|
@ -107,11 +107,12 @@ async function list(bot, discord, channeldc) {
|
|||
} else if (color === 'yellow') {
|
||||
color = 'gold';
|
||||
};
|
||||
message.push({text: value + ' ',
|
||||
message.push({
|
||||
text: value + ' ',
|
||||
color,
|
||||
clickEvent: {
|
||||
action: 'suggest_command',
|
||||
value: `*music play ${value}`,
|
||||
value: `${prefix}music play ${value}`,
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
|
@ -166,7 +167,7 @@ module.exports = {
|
|||
throw new SyntaxError('Invalid argument');
|
||||
}
|
||||
} else if (args[0] === 'list') {
|
||||
list(bot);
|
||||
list(bot, false, null, prefix);
|
||||
} else if (args[0] === 'nowplaying') {
|
||||
bot.tellraw('@a', [{text: 'Now playing '}, {text: bot.music.song.name, color: 'gold'}]);
|
||||
} else {
|
||||
|
@ -231,7 +232,7 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
if (args[0] === 'list') {
|
||||
list(bot, true, channeldc);
|
||||
list(bot, true, channeldc, prefix);
|
||||
}
|
||||
if (args[0] === 'nowplaying') {
|
||||
const Embed = new MessageEmbed()
|
||||
|
|
Loading…
Reference in a new issue