Search code examples
c#.netdiscord

How do i change a Member Nickname in DSharpPlus


How do i change a member nickname in D#+ SlashCommands?

I Tried context.Member.Nickname = "NICKNAME_HERE" but it says "Property or indexer 'DiscordMember.Nickname' cannot be assigned to -- it is read only"


Solution

  • I have found that you can do await context.Member.ModifyAsync(x => x.Nickname = "Test")

    Basically context is the class InteractionContext or CommandContext in a command function and Member is the current user who is using the command and ModifyAsync will make a change to the user properties and we await it.