Add other subreddits to bunny command
This commit is contained in:
parent
7c90b2ff88
commit
3f6379b95e
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) {
|
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) {
|
if (result.IsSuccess) {
|
||||||
const embed = new PublicEmbed(context, result.Result!.Title, "")
|
const embed = new PublicEmbed(context, result.Result!.Title, "")
|
||||||
.setImage(result.Result!.Url)
|
.setImage(result.Result!.Url)
|
||||||
.setURL(`https://reddit.com${result.Result!.Permalink}`)
|
.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();
|
await embed.SendToCurrentChannel();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue