Added meow
This commit is contained in:
parent
5550ef6d91
commit
39c040a367
2 changed files with 40 additions and 1 deletions
|
@ -28,7 +28,6 @@ export class UserCommand extends Command {
|
||||||
private async sendBorf(interactionOrMessage: Message | Command.ChatInputCommandInteraction | Command.ContextMenuCommandInteraction) {
|
private async sendBorf(interactionOrMessage: Message | Command.ChatInputCommandInteraction | Command.ContextMenuCommandInteraction) {
|
||||||
const dogResponse = await fetch('https://dog.ceo/api/breeds/image/random');
|
const dogResponse = await fetch('https://dog.ceo/api/breeds/image/random');
|
||||||
const dogData = await dogResponse.json();
|
const dogData = await dogResponse.json();
|
||||||
console.log(dogData);
|
|
||||||
|
|
||||||
interactionOrMessage instanceof Message
|
interactionOrMessage instanceof Message
|
||||||
? await interactionOrMessage.channel.send({
|
? await interactionOrMessage.channel.send({
|
||||||
|
|
40
src/commands/meow.ts
Normal file
40
src/commands/meow.ts
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
import { ApplyOptions } from '@sapphire/decorators';
|
||||||
|
import { Command } from '@sapphire/framework';
|
||||||
|
import { Message } from 'discord.js';
|
||||||
|
|
||||||
|
@ApplyOptions<Command.Options>({
|
||||||
|
description: 'Meow!'
|
||||||
|
})
|
||||||
|
export class UserCommand extends Command {
|
||||||
|
// Register Chat Input and Context Menu command
|
||||||
|
public override registerApplicationCommands(registry: Command.Registry) {
|
||||||
|
// Register Chat Input command
|
||||||
|
registry.registerChatInputCommand({
|
||||||
|
name: this.name,
|
||||||
|
description: this.description
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Message command
|
||||||
|
public async messageRun(message: Message) {
|
||||||
|
return this.sendMeow(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chat Input (slash) command
|
||||||
|
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
|
||||||
|
return this.sendMeow(interaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async sendMeow(interactionOrMessage: Message | Command.ChatInputCommandInteraction | Command.ContextMenuCommandInteraction) {
|
||||||
|
const catResponse = await fetch('https://cataas.com/cat?json=true');
|
||||||
|
const catData = await catResponse.json();
|
||||||
|
interactionOrMessage instanceof Message
|
||||||
|
? await interactionOrMessage.channel.send({
|
||||||
|
content: `https://cataas.com/${catData.url}`
|
||||||
|
})
|
||||||
|
: await interactionOrMessage.reply({
|
||||||
|
content: `https://cataas.com/${catData.url}`,
|
||||||
|
fetchReply: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue