Setting Nicknames

Is there a good way to set a user's nickname (by userID) when using sapphire?
Solution:
👍
Jump to solution
8 Replies
Favna
Favna11mo ago
The same way you would with discordjs
Lioness100
Lioness10011mo ago
For clarification, you would first fetch the member, then use setNickname()
const member = await guild.members.fetch('id');
await member.setNickname(...);
const member = await guild.members.fetch('id');
await member.setNickname(...);
BifocalCanvas
BifocalCanvas11mo ago
Now I may sound dumb, but where is the guild object coming from
Lioness100
Lioness10011mo ago
That's up to you. It's whatever guild you want to update the nickname in. For example, if you're doing this in response to an interaction, it would be interaction.guild. If you have a specific guild id, it would be:
const guild = client.guilds.cache.get('id');
const guild = client.guilds.cache.get('id');
@bifocalcanvas (in case you don't have notifications on for this thread)
BifocalCanvas
BifocalCanvas11mo ago
Thank you! I got it to work.
Solution
Lioness100
Lioness10011mo ago
👍
Lioness100
Lioness10011mo ago
In the future, as favvy wavvy mentioned, this would be more appropriate for #discordjs-support
BifocalCanvas
BifocalCanvas11mo ago
ah ok