mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-12-04 12:51:21 -05:00
28 lines
888 B
JavaScript
28 lines
888 B
JavaScript
/* eslint-disable max-len */
|
|
const cowsay = require('cowsay2');
|
|
const cows = require('cowsay2/cows');
|
|
module.exports = {
|
|
name: 'cowsay',
|
|
alias: [],
|
|
description: 'Moo',
|
|
usage: '<cow|list> <message>',
|
|
trusted: 0,
|
|
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
|
if (args[0]!=='list') {
|
|
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`}));
|
|
} else {
|
|
let color = '§6';
|
|
let message = '';
|
|
|
|
Object.keys(cows).forEach((value) => {
|
|
if (color==='§6') {
|
|
color = '§e';
|
|
} else if (color==='§e') {
|
|
color = '§6';
|
|
};
|
|
message += color + value + ' ';
|
|
});
|
|
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Cows: ', color: 'green'}, '\n', {text: message, color: 'red'}]));
|
|
}
|
|
},
|
|
};
|