import type { HelpObj } from '../../structures/commandhandler' ; import { MessageEmbed } from 'discord.js' ; import type ReknownClient from '../../structures/client' ; import fetch from 'node-fetch' ; import { stringify } from 'querystring' ; import type { Message , PermissionString } from 'discord.js' ; interface CatResult { breeds : string [ ] ; height : number ; id : string ; url : string ; width : number ; } export async function run ( client , message , args ) { const qs = stringify ( { limit : 1 , size : 'small' } ) ; const json = await fetch ( `https://api.thecatapi.com/v1/images/search?${ qs }` , { headers : { 'Content-Type' : 'application/json' , 'x-api-key' : process . env . THECATAPI_KEY ! } } ) . then ( res => res . json ( ) ) ; const embed = new MessageEmbed ( ) . setColor ( client . config . embedColor ) . setFooter ( `Requested by ${ message . author . tag } | Powered by https://thecatapi.com/` , message . author . displayAvatarURL ( ) ) . setImage ( json [ 0 ] . url ) . setTitle ( 'Kitty!' ) ; message . channel . send ( embed ) ; } export const help = { aliases : [ ] , category : 'Fun' , desc : 'Shows a picture of a cat.' , dm : true , togglable : true , usage : 'cat' } ; export const memberPerms = [ ] ; export const permissions = [ 'EMBED_LINKS' ] ;