Skip to content

Commit

Permalink
Animated profile picture command
Browse files Browse the repository at this point in the history
  • Loading branch information
TFAGaming committed Feb 14, 2024
1 parent 4ba999b commit 30e30f2
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/slash/Developers/eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
* @param {ExtendedClient} client
* @param {ChatInputCommandInteraction<true>} interaction
*/
run: async (client, interaction, args) => {
run: async (client, interaction) => {
await interaction.deferReply();

const code = interaction.options.getString("code");
Expand Down
55 changes: 55 additions & 0 deletions src/commands/slash/Developers/set-animated-pfp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const {
SlashCommandBuilder,
EmbedBuilder,
ChatInputCommandInteraction,
AttachmentBuilder,
Routes,
} = require("discord.js");
const ExtendedClient = require("../../../class/ExtendedClient");

module.exports = {
structure: new SlashCommandBuilder()
.setName("set-animated-pfp")
.setDescription("Change the bot\'s profile picture to an animated one.")
.addAttachmentOption((option) =>
option
.setName("attachment")
.setDescription("The attachment.")
.setRequired(true)
),
options: {
developers: true,
},
/**
* @param {ExtendedClient} client
* @param {ChatInputCommandInteraction<true>} interaction
*/
run: async (client, interaction) => {
await interaction.deferReply();

const attachment = interaction.options.getAttachment('attachment', true);

if (attachment.contentType !== 'image/gif') {
await interaction.editReply({
content: 'Not a .gif image.'
});

return;
};

console.log(attachment)

await client.user.setAvatar(attachment.proxyURL)
.then(async () => {
await interaction.editReply({
content: 'Done, profile picture updated.'
});
})
.catch(async (err) => {
await interaction.editReply({
content: 'Something went wrong:\n' + err
});
});

},
};

0 comments on commit 30e30f2

Please sign in to comment.