@@ -20,8 +20,6 @@ namespace Discord | |||||
string Username { get; } | string Username { get; } | ||||
/// <summary> Returns a private message channel to this user, creating one if it does not already exist. </summary> | /// <summary> Returns a private message channel to this user, creating one if it does not already exist. </summary> | ||||
Task<IDMChannel> GetDMChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null); | |||||
/// <summary> Returns a private message channel to this user, creating one if it does not already exist. </summary> | |||||
Task<IDMChannel> CreateDMChannelAsync(RequestOptions options = null); | |||||
Task<IDMChannel> GetDMChannelAsync(RequestOptions options = null); | |||||
} | } | ||||
} | } |
@@ -54,7 +54,7 @@ namespace Discord.Rest | |||||
Update(model); | Update(model); | ||||
} | } | ||||
public Task<RestDMChannel> CreateDMChannelAsync(RequestOptions options = null) | |||||
public Task<RestDMChannel> GetDMChannelAsync(RequestOptions options = null) | |||||
=> UserHelper.CreateDMChannelAsync(this, Discord, options); | => UserHelper.CreateDMChannelAsync(this, Discord, options); | ||||
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | ||||
@@ -64,9 +64,7 @@ namespace Discord.Rest | |||||
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})"; | private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})"; | ||||
//IUser | //IUser | ||||
Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options) | |||||
=> Task.FromResult<IDMChannel>(null); | |||||
async Task<IDMChannel> IUser.CreateDMChannelAsync(RequestOptions options) | |||||
=> await CreateDMChannelAsync(options).ConfigureAwait(false); | |||||
async Task<IDMChannel> IUser.GetDMChannelAsync(RequestOptions options) | |||||
=> await GetDMChannelAsync(options); | |||||
} | } | ||||
} | } |
@@ -49,7 +49,7 @@ namespace Discord.Rpc | |||||
Username = model.Username.Value; | Username = model.Username.Value; | ||||
} | } | ||||
public Task<RestDMChannel> CreateDMChannelAsync(RequestOptions options = null) | |||||
public Task<RestDMChannel> GetDMChannelAsync(RequestOptions options = null) | |||||
=> UserHelper.CreateDMChannelAsync(this, Discord, options); | => UserHelper.CreateDMChannelAsync(this, Discord, options); | ||||
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | ||||
@@ -59,9 +59,7 @@ namespace Discord.Rpc | |||||
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})"; | private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})"; | ||||
//IUser | //IUser | ||||
Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options) | |||||
=> Task.FromResult<IDMChannel>(null); | |||||
async Task<IDMChannel> IUser.CreateDMChannelAsync(RequestOptions options) | |||||
=> await CreateDMChannelAsync(options).ConfigureAwait(false); | |||||
async Task<IDMChannel> IUser.GetDMChannelAsync(RequestOptions options) | |||||
=> await GetDMChannelAsync(options); | |||||
} | } | ||||
} | } |
@@ -53,10 +53,10 @@ namespace Discord.WebSocket | |||||
hasChanges = true; | hasChanges = true; | ||||
} | } | ||||
return hasChanges; | return hasChanges; | ||||
} | |||||
} | |||||
public Task<RestDMChannel> CreateDMChannelAsync(RequestOptions options = null) | |||||
=> UserHelper.CreateDMChannelAsync(this, Discord, options); | |||||
public async Task<IDMChannel> GetDMChannelAsync(RequestOptions options = null) | |||||
=> GlobalUser.DMChannel ?? await UserHelper.CreateDMChannelAsync(this, Discord, options) as IDMChannel; | |||||
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128) | ||||
=> CDN.GetUserAvatarUrl(Id, AvatarId, size, format); | => CDN.GetUserAvatarUrl(Id, AvatarId, size, format); | ||||
@@ -66,9 +66,7 @@ namespace Discord.WebSocket | |||||
internal SocketUser Clone() => MemberwiseClone() as SocketUser; | internal SocketUser Clone() => MemberwiseClone() as SocketUser; | ||||
//IUser | //IUser | ||||
async Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options) | |||||
=> await Task.FromResult<IDMChannel>(GlobalUser.DMChannel ?? await CreateDMChannelAsync(options) as IDMChannel); | |||||
async Task<IDMChannel> IUser.CreateDMChannelAsync(RequestOptions options) | |||||
=> await CreateDMChannelAsync(options).ConfigureAwait(false); | |||||
Task<IDMChannel> IUser.GetDMChannelAsync(RequestOptions options) | |||||
=> GetDMChannelAsync(options); | |||||
} | } | ||||
} | } |