Add other subreddits to bunny command

This commit is contained in:
Ethan Lane 2022-08-14 13:27:46 +01:00
parent 7c90b2ff88
commit 3f6379b95e

View file

@ -12,13 +12,24 @@ export default class Bunny extends Command {
}
public override async execute(context: ICommandContext) {
const result = await randomBunny('rabbits', 'hot');
const subreddits = [
'rabbits',
'bunnieswithhats',
'buncomfortable',
'bunnytongues',
'dutchbunnymafia',
];
const random = Math.floor(Math.random() * subreddits.length);
const selectedSubreddit = subreddits[random];
const result = await randomBunny(selectedSubreddit, 'hot');
if (result.IsSuccess) {
const embed = new PublicEmbed(context, result.Result!.Title, "")
.setImage(result.Result!.Url)
.setURL(`https://reddit.com${result.Result!.Permalink}`)
.setFooter({ text: `r/Rabbits · ${result.Result!.Ups} upvotes` });
.setFooter({ text: `r/${selectedSubreddit} · ${result.Result!.Ups} upvotes` });
await embed.SendToCurrentChannel();
} else {