chomens-bot-js/commands/cowsay.js

39 lines
961 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-11-07 08:08:29 -05:00
if (args[0]==='list') {
2022-11-08 09:01:38 -05:00
const listed = Object.keys(cows);
2022-08-28 00:39:31 -04:00
2022-11-08 09:01:38 -05:00
let color = 'gold';
const message = [];
listed.forEach((value) => {
if (color === 'gold') {
color = 'yellow';
} else if (color === 'yellow') {
color = 'gold';
2022-08-28 00:39:31 -04:00
};
2022-11-08 09:01:38 -05:00
message.push({
text: value + ' ',
color,
clickEvent: {
action: 'suggest_command',
value: `${prefix}cowsay ${value} `,
},
});
2022-08-28 00:39:31 -04:00
});
2022-11-08 09:01:38 -05:00
bot.tellraw('@a', message);
2022-11-07 08:08:29 -05:00
} else {
bot.tellraw('@a', {text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`});
2022-08-28 00:39:31 -04:00
}
2022-08-14 05:51:45 -04:00
},
};