v3.4.1 #27

Merged
voidf1sh merged 5 commits from v3.4.1 into main 2025-01-25 01:07:27 +00:00
2 changed files with 45 additions and 0 deletions
Showing only changes of commit 232a8ebc21 - Show all commits

View File

@ -662,6 +662,15 @@ const functions = {
return newText + ' <:spongebob:1053398825965985822>';
},
setNick(user, nickname) {
return new Promise((resolve, reject) => {
user.setNickname(nickname).then(() => {
resolve('Nickname set.');
}).catch(err => {
reject(err);
});
});
},
autoresponses: { // Specific responses for certain keywords in sent messages
checkForAll(messageContent) {
let responses = [];

36
slash-commands/setnick.js Normal file
View File

@ -0,0 +1,36 @@
const { SlashCommandBuilder } = require('@discordjs/builders');
const fn = require('../functions.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('setnick')
.setDescription('Set a user\'s nickname.')
.addUserOption(o =>
o.setName('user')
.setDescription('The user to set the nickname for.')
.setRequired(true)
)
.addStringOption(o =>
o.setName('nickname')
.setDescription('The nickname to set.')
.setRequired(true)
),
async execute(interaction) {
try {
// Defer the reply, with ephemeral set to true
await interaction.deferReply({ ephemeral: true });
// Get the user and nickname from the interaction
const user = interaction.options.getMember('user');
const nickname = interaction.options.getString('nickname');
// Set the nickname
await fn.setNick(user, nickname);
// Reply to the interaction
await interaction.editReply(`Successfully set ${user}'s nickname to ${nickname}`);
} catch (error) {
console.error(error);
await interaction.editReply('There was an error while executing this command!');
}
},
};