@@ -12,7 +12,7 @@ namespace Discord.Commands | |||||
public int? Permissions { get; } | public int? Permissions { get; } | ||||
public string[] Args { get; } | public string[] Args { get; } | ||||
public User Member => Message.User; | |||||
public User User => Message.User; | |||||
public Channel Channel => Message.Channel; | public Channel Channel => Message.Channel; | ||||
public Server Server => Message.Channel.Server; | public Server Server => Message.Channel.Server; | ||||
@@ -169,9 +169,6 @@ | |||||
<Compile Include="..\Discord.Net\DiscordClient.Invites.cs"> | <Compile Include="..\Discord.Net\DiscordClient.Invites.cs"> | ||||
<Link>DiscordClient.Invites.cs</Link> | <Link>DiscordClient.Invites.cs</Link> | ||||
</Compile> | </Compile> | ||||
<Compile Include="..\Discord.Net\DiscordClient.Members.cs"> | |||||
<Link>DiscordClient.Members.cs</Link> | |||||
</Compile> | |||||
<Compile Include="..\Discord.Net\DiscordClient.Messages.cs"> | <Compile Include="..\Discord.Net\DiscordClient.Messages.cs"> | ||||
<Link>DiscordClient.Messages.cs</Link> | <Link>DiscordClient.Messages.cs</Link> | ||||
</Compile> | </Compile> | ||||
@@ -137,7 +137,7 @@ namespace Discord | |||||
} | } | ||||
//Members | //Members | ||||
public Task EditMember(string serverId, string userId, bool? mute = null, bool? deaf = null, IEnumerable<string> roles = null) | |||||
public Task EditUser(string serverId, string userId, bool? mute = null, bool? deaf = null, IEnumerable<string> roles = null) | |||||
{ | { | ||||
if (serverId == null) throw new ArgumentNullException(nameof(serverId)); | if (serverId == null) throw new ArgumentNullException(nameof(serverId)); | ||||
if (userId == null) throw new ArgumentNullException(nameof(userId)); | if (userId == null) throw new ArgumentNullException(nameof(userId)); | ||||
@@ -1,4 +1,3 @@ | |||||
using Discord.Net; | |||||
using System; | using System; | ||||
using System.Net; | using System.Net; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
@@ -33,13 +32,13 @@ namespace Discord | |||||
} | } | ||||
/// <summary> Bans a user from the provided server. </summary> | /// <summary> Bans a user from the provided server. </summary> | ||||
public Task Ban(User member) | |||||
public Task Ban(User user) | |||||
{ | { | ||||
if (member == null) throw new ArgumentNullException(nameof(member)); | |||||
if (member.Server == null) throw new ArgumentException("Unable to ban a user in a private chat."); | |||||
if (user == null) throw new ArgumentNullException(nameof(user)); | |||||
if (user.Server == null) throw new ArgumentException("Unable to ban a user in a private chat."); | |||||
CheckReady(); | CheckReady(); | ||||
return _api.Ban(member.Server.Id, member.Id); | |||||
return _api.Ban(user.Server.Id, user.Id); | |||||
} | } | ||||
/// <summary> Unbans a user from the provided server. </summary> | /// <summary> Unbans a user from the provided server. </summary> | ||||
@@ -96,17 +96,17 @@ namespace Discord | |||||
} | } | ||||
/// <summary> Returns the private channel with the provided user, creating one if it does not currently exist. </summary> | /// <summary> Returns the private channel with the provided user, creating one if it does not currently exist. </summary> | ||||
public async Task<Channel> CreatePMChannel(User member) | |||||
public async Task<Channel> CreatePMChannel(User user) | |||||
{ | { | ||||
if (member == null) throw new ArgumentNullException(nameof(member)); | |||||
if (user == null) throw new ArgumentNullException(nameof(user)); | |||||
CheckReady(); | CheckReady(); | ||||
Channel channel = null; | Channel channel = null; | ||||
if (member != null) | |||||
channel = member.GlobalUser.PrivateChannel; | |||||
if (user != null) | |||||
channel = user.GlobalUser.PrivateChannel; | |||||
if (channel == null) | if (channel == null) | ||||
{ | { | ||||
var response = await _api.CreatePMChannel(_userId, member.Id).ConfigureAwait(false); | |||||
var response = await _api.CreatePMChannel(_userId, user.Id).ConfigureAwait(false); | |||||
var recipient = _users.GetOrAdd(response.Recipient?.Id, null); | var recipient = _users.GetOrAdd(response.Recipient?.Id, null); | ||||
recipient.Update(response.Recipient); | recipient.Update(response.Recipient); | ||||
channel = _channels.GetOrAdd(response.Id, response.GuildId, response.Recipient?.Id); | channel = _channels.GetOrAdd(response.Id, response.GuildId, response.Recipient?.Id); | ||||
@@ -1,127 +0,0 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Threading.Tasks; | |||||
namespace Discord | |||||
{ | |||||
internal sealed class Users : AsyncCollection<User> | |||||
{ | |||||
public Users(DiscordClient client, object writerLock) | |||||
: base(client, writerLock) { } | |||||
private string GetKey(string userId, string serverId) | |||||
=> User.GetId(userId, serverId); | |||||
public User this[string userId, string serverId] | |||||
=> this[GetKey(userId, serverId)]; | |||||
public User GetOrAdd(string userId, string serverId) | |||||
=> GetOrAdd(GetKey(userId, serverId), () => new User(_client, userId, serverId)); | |||||
public User TryRemove(string userId, string serverId) | |||||
=> TryRemove(GetKey(userId, serverId)); | |||||
} | |||||
public class MemberEventArgs : EventArgs | |||||
{ | |||||
public User User { get; } | |||||
public Server Server => User.Server; | |||||
internal MemberEventArgs(User user) { User = user; } | |||||
} | |||||
public class UserChannelEventArgs : MemberEventArgs | |||||
{ | |||||
public Channel Channel { get; } | |||||
public string ChannelId => Channel.Id; | |||||
internal UserChannelEventArgs(User user, Channel channel) | |||||
: base(user) | |||||
{ | |||||
Channel = channel; | |||||
} | |||||
} | |||||
public class MemberIsSpeakingEventArgs : UserChannelEventArgs | |||||
{ | |||||
public bool IsSpeaking { get; } | |||||
internal MemberIsSpeakingEventArgs(User member, Channel channel, bool isSpeaking) | |||||
: base(member, channel) | |||||
{ | |||||
IsSpeaking = isSpeaking; | |||||
} | |||||
} | |||||
public partial class DiscordClient | |||||
{ | |||||
public event EventHandler<UserChannelEventArgs> UserIsTyping; | |||||
private void RaiseUserIsTyping(User member, Channel channel) | |||||
{ | |||||
if (UserIsTyping != null) | |||||
RaiseEvent(nameof(UserIsTyping), () => UserIsTyping(this, new UserChannelEventArgs(member, channel))); | |||||
} | |||||
public event EventHandler<MemberIsSpeakingEventArgs> UserIsSpeaking; | |||||
private void RaiseUserIsSpeaking(User member, Channel channel, bool isSpeaking) | |||||
{ | |||||
if (UserIsSpeaking != null) | |||||
RaiseEvent(nameof(UserIsSpeaking), () => UserIsSpeaking(this, new MemberIsSpeakingEventArgs(member, channel, isSpeaking))); | |||||
} | |||||
private User _currentUser; | |||||
internal Users Users => _users; | |||||
private readonly Users _users; | |||||
/// <summary> Returns the user with the specified id, along with their server-specific data, or null if none was found. </summary> | |||||
public User GetMember(Server server, string userId) | |||||
{ | |||||
if (server == null) throw new ArgumentNullException(nameof(server)); | |||||
if (userId == null) throw new ArgumentNullException(nameof(userId)); | |||||
CheckReady(); | |||||
return _users[userId, server.Id]; | |||||
} | |||||
/// <summary> Returns the user with the specified name and discriminator, along withtheir server-specific data, or null if they couldn't be found. </summary> | |||||
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive. </remarks> | |||||
public User GetMember(Server server, string username, string discriminator) | |||||
{ | |||||
if (server == null) throw new ArgumentNullException(nameof(server)); | |||||
if (username == null) throw new ArgumentNullException(nameof(username)); | |||||
if (discriminator == null) throw new ArgumentNullException(nameof(discriminator)); | |||||
CheckReady(); | |||||
User member = FindMembers(server, username, discriminator, true).FirstOrDefault(); | |||||
return _users[member?.Id, server.Id]; | |||||
} | |||||
/// <summary> Returns all users in with the specified server and name, along with their server-specific data. </summary> | |||||
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive.</remarks> | |||||
public IEnumerable<User> FindMembers(Server server, string name, string discriminator = null, bool exactMatch = false) | |||||
{ | |||||
if (server == null) throw new ArgumentNullException(nameof(server)); | |||||
if (name == null) throw new ArgumentNullException(nameof(name)); | |||||
CheckReady(); | |||||
IEnumerable<User> query; | |||||
if (!exactMatch && name.StartsWith("@")) | |||||
{ | |||||
string name2 = name.Substring(1); | |||||
query = server.Members.Where(x => | |||||
string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase) || | |||||
string.Equals(x.Name, name2, StringComparison.OrdinalIgnoreCase)); | |||||
} | |||||
else | |||||
{ | |||||
query = server.Members.Where(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); | |||||
} | |||||
if (discriminator != null) | |||||
query = query.Where(x => x.Discriminator == discriminator); | |||||
return query; | |||||
} | |||||
public Task EditMember(User member, bool? mute = null, bool? deaf = null, IEnumerable<Role> roles = null) | |||||
{ | |||||
if (member == null) throw new ArgumentNullException(nameof(member)); | |||||
CheckReady(); | |||||
return _api.EditMember(member.Server?.Id, member.Id, mute: mute, deaf: deaf, roles: roles.Select(x => x.Id)); | |||||
} | |||||
} | |||||
} |
@@ -34,7 +34,7 @@ namespace Discord | |||||
public class MessageEventArgs : EventArgs | public class MessageEventArgs : EventArgs | ||||
{ | { | ||||
public Message Message { get; } | public Message Message { get; } | ||||
public User Member => Message.User; | |||||
public User User => Message.User; | |||||
public Channel Channel => Message.Channel; | public Channel Channel => Message.Channel; | ||||
public Server Server => Message.Server; | public Server Server => Message.Server; | ||||
@@ -101,13 +101,13 @@ namespace Discord | |||||
return SendMessage(channel, text, false); | return SendMessage(channel, text, false); | ||||
} | } | ||||
/// <summary> Sends a private message to the provided user. </summary> | /// <summary> Sends a private message to the provided user. </summary> | ||||
public async Task<Message> SendPrivateMessage(User member, string text) | |||||
public async Task<Message> SendPrivateMessage(User user, string text) | |||||
{ | { | ||||
if (member == null) throw new ArgumentNullException(nameof(member)); | |||||
if (user == null) throw new ArgumentNullException(nameof(user)); | |||||
if (text == null) throw new ArgumentNullException(nameof(text)); | if (text == null) throw new ArgumentNullException(nameof(text)); | ||||
CheckReady(); | CheckReady(); | ||||
var channel = await CreatePMChannel(member).ConfigureAwait(false); | |||||
var channel = await CreatePMChannel(user).ConfigureAwait(false); | |||||
return await SendMessage(channel, text).ConfigureAwait(false); | return await SendMessage(channel, text).ConfigureAwait(false); | ||||
} | } | ||||
private async Task<Message> SendMessage(Channel channel, string text, bool isTextToSpeech) | private async Task<Message> SendMessage(Channel channel, string text, bool isTextToSpeech) | ||||
@@ -218,9 +218,9 @@ namespace Discord | |||||
{ | { | ||||
if (!channel.IsPrivate) | if (!channel.IsPrivate) | ||||
{ | { | ||||
var member = msg.User; | |||||
if (member != null) | |||||
member.UpdateActivity(msg.EditedTimestamp ?? msg.Timestamp); | |||||
var user = msg.User; | |||||
if (user != null) | |||||
user.UpdateActivity(msg.EditedTimestamp ?? msg.Timestamp); | |||||
} | } | ||||
} | } | ||||
return msg; | return msg; | ||||
@@ -15,13 +15,13 @@ namespace Discord | |||||
return SetChannelPermissions(channel, member?.Id, PermissionTarget.User, allow, deny); | return SetChannelPermissions(channel, member?.Id, PermissionTarget.User, allow, deny); | ||||
} | } | ||||
public Task SetChannelUserPermissions(Channel channel, User member, DualChannelPermissions permissions = null) | |||||
public Task SetChannelUserPermissions(Channel channel, User user, DualChannelPermissions permissions = null) | |||||
{ | { | ||||
if (channel == null) throw new ArgumentNullException(nameof(channel)); | if (channel == null) throw new ArgumentNullException(nameof(channel)); | ||||
if (member == null) throw new ArgumentNullException(nameof(member)); | |||||
if (user == null) throw new ArgumentNullException(nameof(user)); | |||||
CheckReady(); | CheckReady(); | ||||
return SetChannelPermissions(channel, member?.Id, PermissionTarget.User, permissions?.Allow, permissions?.Deny); | |||||
return SetChannelPermissions(channel, user?.Id, PermissionTarget.User, permissions?.Allow, permissions?.Deny); | |||||
} | } | ||||
public Task SetChannelRolePermissions(Channel channel, Role role, ChannelPermissions allow = null, ChannelPermissions deny = null) | public Task SetChannelRolePermissions(Channel channel, Role role, ChannelPermissions allow = null, ChannelPermissions deny = null) | ||||
{ | { | ||||
@@ -95,13 +95,13 @@ namespace Discord | |||||
} | } | ||||
} | } | ||||
public Task RemoveChannelUserPermissions(Channel channel, User member) | |||||
public Task RemoveChannelUserPermissions(Channel channel, User user) | |||||
{ | { | ||||
if (channel == null) throw new ArgumentNullException(nameof(channel)); | if (channel == null) throw new ArgumentNullException(nameof(channel)); | ||||
if (member == null) throw new ArgumentNullException(nameof(member)); | |||||
if (user == null) throw new ArgumentNullException(nameof(user)); | |||||
CheckReady(); | CheckReady(); | ||||
return RemoveChannelPermissions(channel, member?.Id, PermissionTarget.User); | |||||
return RemoveChannelPermissions(channel, user?.Id, PermissionTarget.User); | |||||
} | } | ||||
public Task RemoveChannelRolePermissions(Channel channel, Role role) | public Task RemoveChannelRolePermissions(Channel channel, Role role) | ||||
{ | { | ||||
@@ -13,20 +13,76 @@ namespace Discord | |||||
public GlobalUser GetOrAdd(string id) => GetOrAdd(id, () => new GlobalUser(_client, id)); | public GlobalUser GetOrAdd(string id) => GetOrAdd(id, () => new GlobalUser(_client, id)); | ||||
} | } | ||||
internal sealed class Users : AsyncCollection<User> | |||||
{ | |||||
public Users(DiscordClient client, object writerLock) | |||||
: base(client, writerLock) | |||||
{ } | |||||
private string GetKey(string userId, string serverId) | |||||
=> User.GetId(userId, serverId); | |||||
public User this[string userId, string serverId] | |||||
=> this[GetKey(userId, serverId)]; | |||||
public User GetOrAdd(string userId, string serverId) | |||||
=> GetOrAdd(GetKey(userId, serverId), () => new User(_client, userId, serverId)); | |||||
public User TryRemove(string userId, string serverId) | |||||
=> TryRemove(GetKey(userId, serverId)); | |||||
} | |||||
public class UserEventArgs : EventArgs | |||||
{ | |||||
public User User { get; } | |||||
public Server Server => User.Server; | |||||
internal UserEventArgs(User user) { User = user; } | |||||
} | |||||
public class UserChannelEventArgs : UserEventArgs | |||||
{ | |||||
public Channel Channel { get; } | |||||
public string ChannelId => Channel.Id; | |||||
internal UserChannelEventArgs(User user, Channel channel) | |||||
: base(user) | |||||
{ | |||||
Channel = channel; | |||||
} | |||||
} | |||||
public class UserIsSpeakingEventArgs : UserChannelEventArgs | |||||
{ | |||||
public bool IsSpeaking { get; } | |||||
internal UserIsSpeakingEventArgs(User member, Channel channel, bool isSpeaking) | |||||
: base(member, channel) | |||||
{ | |||||
IsSpeaking = isSpeaking; | |||||
} | |||||
} | |||||
public partial class DiscordClient | public partial class DiscordClient | ||||
{ | { | ||||
public event EventHandler<MemberEventArgs> UserAdded; | |||||
private void RaiseUserAdded(User member) | |||||
public event EventHandler<UserChannelEventArgs> UserIsTyping; | |||||
private void RaiseUserIsTyping(User user, Channel channel) | |||||
{ | |||||
if (UserIsTyping != null) | |||||
RaiseEvent(nameof(UserIsTyping), () => UserIsTyping(this, new UserChannelEventArgs(user, channel))); | |||||
} | |||||
public event EventHandler<UserIsSpeakingEventArgs> UserIsSpeaking; | |||||
private void RaiseUserIsSpeaking(User user, Channel channel, bool isSpeaking) | |||||
{ | |||||
if (UserIsSpeaking != null) | |||||
RaiseEvent(nameof(UserIsSpeaking), () => UserIsSpeaking(this, new UserIsSpeakingEventArgs(user, channel, isSpeaking))); | |||||
} | |||||
public event EventHandler<UserEventArgs> UserAdded; | |||||
private void RaiseUserAdded(User user) | |||||
{ | { | ||||
if (UserAdded != null) | if (UserAdded != null) | ||||
RaiseEvent(nameof(UserAdded), () => UserAdded(this, new MemberEventArgs(member))); | |||||
RaiseEvent(nameof(UserAdded), () => UserAdded(this, new UserEventArgs(user))); | |||||
} | } | ||||
public event EventHandler<MemberEventArgs> UserRemoved; | |||||
private void RaiseUserRemoved(User member) | |||||
public event EventHandler<UserEventArgs> UserRemoved; | |||||
private void RaiseUserRemoved(User user) | |||||
{ | { | ||||
if (UserRemoved != null) | if (UserRemoved != null) | ||||
RaiseEvent(nameof(UserRemoved), () => UserRemoved(this, new MemberEventArgs(member))); | |||||
RaiseEvent(nameof(UserRemoved), () => UserRemoved(this, new UserEventArgs(user))); | |||||
} | } | ||||
public event EventHandler ProfileUpdated; | public event EventHandler ProfileUpdated; | ||||
private void RaiseProfileUpdated() | private void RaiseProfileUpdated() | ||||
@@ -34,29 +90,89 @@ namespace Discord | |||||
if (ProfileUpdated != null) | if (ProfileUpdated != null) | ||||
RaiseEvent(nameof(ProfileUpdated), () => ProfileUpdated(this, EventArgs.Empty)); | RaiseEvent(nameof(ProfileUpdated), () => ProfileUpdated(this, EventArgs.Empty)); | ||||
} | } | ||||
public event EventHandler<MemberEventArgs> MemberUpdated; | |||||
private void RaiseMemberUpdated(User member) | |||||
public event EventHandler<UserEventArgs> UserUpdated; | |||||
private void RaiseMemberUpdated(User user) | |||||
{ | { | ||||
if (MemberUpdated != null) | |||||
RaiseEvent(nameof(MemberUpdated), () => MemberUpdated(this, new MemberEventArgs(member))); | |||||
if (UserUpdated != null) | |||||
RaiseEvent(nameof(UserUpdated), () => UserUpdated(this, new UserEventArgs(user))); | |||||
} | } | ||||
public event EventHandler<MemberEventArgs> UserPresenceUpdated; | |||||
private void RaiseUserPresenceUpdated(User member) | |||||
public event EventHandler<UserEventArgs> UserPresenceUpdated; | |||||
private void RaiseUserPresenceUpdated(User user) | |||||
{ | { | ||||
if (UserPresenceUpdated != null) | if (UserPresenceUpdated != null) | ||||
RaiseEvent(nameof(UserPresenceUpdated), () => UserPresenceUpdated(this, new MemberEventArgs(member))); | |||||
RaiseEvent(nameof(UserPresenceUpdated), () => UserPresenceUpdated(this, new UserEventArgs(user))); | |||||
} | } | ||||
public event EventHandler<MemberEventArgs> UserVoiceStateUpdated; | |||||
private void RaiseUserVoiceStateUpdated(User member) | |||||
public event EventHandler<UserEventArgs> UserVoiceStateUpdated; | |||||
private void RaiseUserVoiceStateUpdated(User user) | |||||
{ | { | ||||
if (UserVoiceStateUpdated != null) | if (UserVoiceStateUpdated != null) | ||||
RaiseEvent(nameof(UserVoiceStateUpdated), () => UserVoiceStateUpdated(this, new MemberEventArgs(member))); | |||||
RaiseEvent(nameof(UserVoiceStateUpdated), () => UserVoiceStateUpdated(this, new UserEventArgs(user))); | |||||
} | } | ||||
private User _currentUser; | |||||
/// <summary> Returns a collection of all users this client can currently see. </summary> | /// <summary> Returns a collection of all users this client can currently see. </summary> | ||||
internal GlobalUsers GlobalUsers => _globalUsers; | internal GlobalUsers GlobalUsers => _globalUsers; | ||||
private readonly GlobalUsers _globalUsers; | private readonly GlobalUsers _globalUsers; | ||||
internal Users Users => _users; | |||||
private readonly Users _users; | |||||
/// <summary> Returns the user with the specified id, along with their server-specific data, or null if none was found. </summary> | |||||
public User GetMember(Server server, string userId) | |||||
{ | |||||
if (server == null) throw new ArgumentNullException(nameof(server)); | |||||
if (userId == null) throw new ArgumentNullException(nameof(userId)); | |||||
CheckReady(); | |||||
return _users[userId, server.Id]; | |||||
} | |||||
/// <summary> Returns the user with the specified name and discriminator, along withtheir server-specific data, or null if they couldn't be found. </summary> | |||||
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive. </remarks> | |||||
public User GetUser(Server server, string username, string discriminator) | |||||
{ | |||||
if (server == null) throw new ArgumentNullException(nameof(server)); | |||||
if (username == null) throw new ArgumentNullException(nameof(username)); | |||||
if (discriminator == null) throw new ArgumentNullException(nameof(discriminator)); | |||||
CheckReady(); | |||||
User user = FindMembers(server, username, discriminator, true).FirstOrDefault(); | |||||
return _users[user?.Id, server.Id]; | |||||
} | |||||
/// <summary> Returns all users in with the specified server and name, along with their server-specific data. </summary> | |||||
/// <remarks> Name formats supported: Name and @Name. Search is case-insensitive.</remarks> | |||||
public IEnumerable<User> FindMembers(Server server, string name, string discriminator = null, bool exactMatch = false) | |||||
{ | |||||
if (server == null) throw new ArgumentNullException(nameof(server)); | |||||
if (name == null) throw new ArgumentNullException(nameof(name)); | |||||
CheckReady(); | |||||
IEnumerable<User> query; | |||||
if (!exactMatch && name.StartsWith("@")) | |||||
{ | |||||
string name2 = name.Substring(1); | |||||
query = server.Members.Where(x => | |||||
string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase) || | |||||
string.Equals(x.Name, name2, StringComparison.OrdinalIgnoreCase)); | |||||
} | |||||
else | |||||
{ | |||||
query = server.Members.Where(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)); | |||||
} | |||||
if (discriminator != null) | |||||
query = query.Where(x => x.Discriminator == discriminator); | |||||
return query; | |||||
} | |||||
public Task EditMember(User member, bool? mute = null, bool? deaf = null, IEnumerable<Role> roles = null) | |||||
{ | |||||
if (member == null) throw new ArgumentNullException(nameof(member)); | |||||
CheckReady(); | |||||
return _api.EditUser(member.Server?.Id, member.Id, mute: mute, deaf: deaf, roles: roles.Select(x => x.Id)); | |||||
} | |||||
public Task<EditUserResponse> EditProfile(string currentPassword = "", | public Task<EditUserResponse> EditProfile(string currentPassword = "", | ||||
string username = null, string email = null, string password = null, | string username = null, string email = null, string password = null, | ||||
ImageType avatarType = ImageType.Png, byte[] avatar = null) | ImageType avatarType = ImageType.Png, byte[] avatar = null) | ||||