mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-12-17 19:02:22 -05:00
38 lines
961 B
JavaScript
38 lines
961 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') {
|
|
const listed = Object.keys(cows);
|
|
|
|
let color = 'gold';
|
|
const message = [];
|
|
|
|
listed.forEach((value) => {
|
|
if (color === 'gold') {
|
|
color = 'yellow';
|
|
} else if (color === 'yellow') {
|
|
color = 'gold';
|
|
};
|
|
message.push({
|
|
text: value + ' ',
|
|
color,
|
|
clickEvent: {
|
|
action: 'suggest_command',
|
|
value: `${prefix}cowsay ${value} `,
|
|
},
|
|
});
|
|
});
|
|
|
|
bot.tellraw('@a', message);
|
|
} else {
|
|
bot.tellraw('@a', {text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`});
|
|
}
|
|
},
|
|
};
|