add banner ctx command

This commit is contained in:
bignutty 2024-05-18 13:59:54 +02:00
parent 8937b5d10c
commit 93a95a0523
4 changed files with 36 additions and 4 deletions

View file

@ -0,0 +1,34 @@
const { Constants } = require('detritus-client');
const { InteractionCallbackTypes, ApplicationCommandTypes } = Constants;
const { createEmbed } = require('../../../labscore/utils/embed');
const { editOrReply } = require('../../../labscore/utils/message');
module.exports = {
name: 'View User Banner',
type: ApplicationCommandTypes.USER,
contexts: [
0,
1,
2
],
integrationTypes: [
1
],
run: async (context, args) => {
try{
await context.respond({ data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE })
let u = await context.client.rest.fetchUser(args.user.id);
if(!u.bannerUrl) return editOrReply(context, createEmbed("warning", context, "User doesn't have a banner set."));
return editOrReply(context, createEmbed("default", context, {
image: {
url: u.bannerUrl + '?size=4096'
}
}))
}catch(e){
console.log(e)
}
},
};