Add bunny command back
This commit is contained in:
parent
861676ed0b
commit
1d354a723f
2 changed files with 31 additions and 0 deletions
29
src/commands/bunny.ts
Normal file
29
src/commands/bunny.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import ErrorEmbed from "../helpers/embeds/ErrorEmbed";
|
||||||
|
import PublicEmbed from "../helpers/embeds/PublicEmbed";
|
||||||
|
import { Command } from "../type/command";
|
||||||
|
import { ICommandContext } from "../contracts/ICommandContext";
|
||||||
|
import randomBunny from "random-bunny";
|
||||||
|
|
||||||
|
export default class Bunny extends Command {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
super.Category = "Fun";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async execute(context: ICommandContext) {
|
||||||
|
const result = await randomBunny('rabbits', '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` });
|
||||||
|
|
||||||
|
embed.SendToCurrentChannel();
|
||||||
|
} else {
|
||||||
|
const errorEmbed = new ErrorEmbed(context, "There was an error using this command.");
|
||||||
|
errorEmbed.SendToCurrentChannel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,11 +24,13 @@ import Lobby from "./commands/501231711271780357/lobby";
|
||||||
// Event Imports
|
// Event Imports
|
||||||
import MemberEvents from "./events/MemberEvents";
|
import MemberEvents from "./events/MemberEvents";
|
||||||
import MessageEvents from "./events/MessageEvents";
|
import MessageEvents from "./events/MessageEvents";
|
||||||
|
import Bunny from "./commands/bunny";
|
||||||
|
|
||||||
export default class Registry {
|
export default class Registry {
|
||||||
public static RegisterCommands() {
|
public static RegisterCommands() {
|
||||||
CoreClient.RegisterCommand("about", new About());
|
CoreClient.RegisterCommand("about", new About());
|
||||||
CoreClient.RegisterCommand("ban", new Ban());
|
CoreClient.RegisterCommand("ban", new Ban());
|
||||||
|
CoreClient.RegisterCommand("bunny", new Bunny());
|
||||||
CoreClient.RegisterCommand("clear", new Clear());
|
CoreClient.RegisterCommand("clear", new Clear());
|
||||||
CoreClient.RegisterCommand("help", new Help());
|
CoreClient.RegisterCommand("help", new Help());
|
||||||
CoreClient.RegisterCommand("kick", new Kick());
|
CoreClient.RegisterCommand("kick", new Kick());
|
||||||
|
|
Loading…
Reference in a new issue