Browse Source

Add support for changing Nicknames!

User.Edit(nickname: "foo");
pull/57/head
Lirusaito 9 years ago
parent
commit
641401da4d
2 changed files with 5 additions and 2 deletions
  1. +2
    -0
      src/Discord.Net/API/Client/Rest/UpdateMember.cs
  2. +3
    -2
      src/Discord.Net/Models/User.cs

+ 2
- 0
src/Discord.Net/API/Client/Rest/UpdateMember.cs View File

@@ -21,6 +21,8 @@ namespace Discord.API.Client.Rest
public ulong? VoiceChannelId { get; set; } public ulong? VoiceChannelId { get; set; }
[JsonProperty("roles"), JsonConverter(typeof(LongStringArrayConverter))] [JsonProperty("roles"), JsonConverter(typeof(LongStringArrayConverter))]
public ulong[] RoleIds { get; set; } public ulong[] RoleIds { get; set; }
[JsonProperty("nick")]
public string Nickname { get; set; }


public UpdateMemberRequest(ulong guildId, ulong userId) public UpdateMemberRequest(ulong guildId, ulong userId)
{ {


+ 3
- 2
src/Discord.Net/Models/User.cs View File

@@ -247,7 +247,7 @@ namespace Discord
LastActivityAt = activity ?? DateTime.UtcNow; LastActivityAt = activity ?? DateTime.UtcNow;
} }


public Task Edit(bool? isMuted = null, bool? isDeafened = null, Channel voiceChannel = null, IEnumerable<Role> roles = null)
public Task Edit(bool? isMuted = null, bool? isDeafened = null, Channel voiceChannel = null, IEnumerable<Role> roles = null, string nickname = null)
{ {
if (Server == null) throw new InvalidOperationException("Unable to edit users in a private channel"); if (Server == null) throw new InvalidOperationException("Unable to edit users in a private channel");


@@ -263,7 +263,8 @@ namespace Discord
IsMuted = isMuted ?? IsServerMuted, IsMuted = isMuted ?? IsServerMuted,
IsDeafened = isDeafened ?? IsServerDeafened, IsDeafened = isDeafened ?? IsServerDeafened,
VoiceChannelId = voiceChannel?.Id, VoiceChannelId = voiceChannel?.Id,
RoleIds = roleIds
RoleIds = roleIds,
Nickname = nickname ?? Nickname
}; };
return Client.ClientAPI.Send(request); return Client.ClientAPI.Send(request);
} }


Loading…
Cancel
Save