Add other subreddits to bunny command (#177)
Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/177
This commit is contained in:
parent
7c90b2ff88
commit
bc24a4ecfe
1 changed files with 13 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue