chomens-bot-js/commands/cowsay.js

29 lines
888 B
JavaScript
Raw Normal View History

2022-08-14 05:51:45 -04:00
/* eslint-disable max-len */
2022-08-22 06:14:03 -04:00
const cowsay = require('cowsay2');
2022-08-27 22:03:14 -04:00
const cows = require('cowsay2/cows');
2022-08-14 05:51:45 -04:00
module.exports = {
name: 'cowsay',
alias: [],
description: 'Moo',
2022-08-28 00:39:31 -04:00
usage: '<cow|list> <message>',
2022-08-14 05:51:45 -04:00
trusted: 0,
execute: function(bot, username, usernameraw, sender, prefix, args) {
2022-08-28 00:39:31 -04:00
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'}]));
}
2022-08-14 05:51:45 -04:00
},
};