Skip to content

Commit

Permalink
feat: /set-name command
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirasaki committed Mar 13, 2023
1 parent 7bae016 commit bfae3a2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/commands/developer/set-name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { ApplicationCommandOptionType } = require('discord.js');
const { ChatInputCommand } = require('../../classes/Commands');

module.exports = new ChatInputCommand({
permLevel: 'Developer',
// Global rate limit of 2 requests per hour
cooldown: {
usages: 2,
duration: 3600,
type: 'global'
},
data: {
description: 'Update the bot\'s username',
options: [
{
type: ApplicationCommandOptionType.String,
name: 'name',
description: 'The bot\'s new username',
required: true
}
]
},

run: async (client, interaction) => {
const { member, options } = interaction;
const { emojis } = client.container;
const name = options.getString('name');
client.user
.setUsername(name)
.then(() => interaction.reply(`${ emojis.success } ${ member }, name was successfully updated!`))
.catch((err) => interaction.reply(`${ emojis.error } ${ member }, couldn't update bot's username:\n\n${ err.message }`));
}
});

0 comments on commit bfae3a2

Please sign in to comment.