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
Favna2y ago
The same way you would with discordjs
Lioness100
Lioness1002y 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
BifocalCanvasOP2y ago
Now I may sound dumb, but where is the guild object coming from
Lioness100
Lioness1002y 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
BifocalCanvasOP2y ago
Thank you! I got it to work.
Solution
Lioness100
Lioness1002y ago
👍
Lioness100
Lioness1002y ago
In the future, as favvy wavvy mentioned, this would be more appropriate for #discordjs-support
BifocalCanvas
BifocalCanvasOP2y ago
ah ok
Want results from more Discord servers?
Add your server