feat: add Cat module with /cat and /catgif commands using TheCatAPI
All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 7s
All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 7s
This commit is contained in:
31
src/commands/utility/catgif.ts
Normal file
31
src/commands/utility/catgif.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||
import { Command } from '../../structures/Command.js';
|
||||
import { CatManager } from '../../structures/CatManager.js';
|
||||
|
||||
const command: Command = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('catgif')
|
||||
.setDescription('Postet direkt ein zufälliges Katzen-GIF.')
|
||||
.setDMPermission(true),
|
||||
category: 'Public',
|
||||
async execute(interaction: any) {
|
||||
await interaction.deferReply();
|
||||
|
||||
const imageUrl = await CatManager.fetchCatImage('gif');
|
||||
if (!imageUrl) {
|
||||
await interaction.editReply('❌ Konnte kein Katzen-GIF laden. Bitte versuche es später erneut.');
|
||||
return;
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('🐱 Zufälliges Katzen-GIF')
|
||||
.setURL(imageUrl)
|
||||
.setImage(imageUrl)
|
||||
.setColor(0xf39c12)
|
||||
.setTimestamp();
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
},
|
||||
};
|
||||
|
||||
export default command;
|
||||
Reference in New Issue
Block a user