From bc24a4ecfe434cef6f49e82aa2f93b971cd7f0e8 Mon Sep 17 00:00:00 2001 From: Vylpes Date: Tue, 16 Aug 2022 18:12:32 +0100 Subject: [PATCH] Add other subreddits to bunny command (#177) Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/177 --- src/commands/bunny.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/commands/bunny.ts b/src/commands/bunny.ts index 47bafa6..a41e179 100644 --- a/src/commands/bunny.ts +++ b/src/commands/bunny.ts @@ -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 {