Files
xiao/commands/games/fishy.js
T
2017-10-30 18:13:00 +00:00

28 lines
784 B
JavaScript

const { Command } = require('discord.js-commando');
const { randomRange } = require('../../util/Util');
const fishes = require('../../assets/json/fishy');
module.exports = class FishyCommand extends Command {
constructor(client) {
super(client, {
name: 'fishy',
aliases: ['fish', 'fishing'],
group: 'games',
memberName: 'fishy',
description: 'Go fishing.'
});
}
run(msg) {
const fishID = Math.floor(Math.random() * 10) + 1;
let rarity;
if (fishID < 5) rarity = 'junk';
else if (fishID < 8) rarity = 'common';
else if (fishID < 10) rarity = 'uncommon';
else rarity = 'rare';
const fish = fishes[rarity];
const worth = randomRange(fish.min, fish.max);
return msg.say(`You caught a ${fish.symbol}. I bet it'd sell for around $${worth}.`);
}
};