@@ -1,5 +1,6 @@
using Discord.Rest;
using Discord.Rest;
using System;
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Model = Discord.API.User;
using Model = Discord.API.User;
using PresenceModel = Discord.API.Presence;
using PresenceModel = Discord.API.Presence;
@@ -21,6 +22,7 @@ namespace Discord.WebSocket
public string Mention => MentionUtils.MentionUser(Id);
public string Mention => MentionUtils.MentionUser(Id);
public Game? Game => Presence.Game;
public Game? Game => Presence.Game;
public UserStatus Status => Presence.Status;
public UserStatus Status => Presence.Status;
public RelationshipType Relationship => Discord.Relationships.FirstOrDefault(r => r.User.Id == Id)?.Type ?? RelationshipType.None;
internal SocketUser(DiscordSocketClient discord, ulong id)
internal SocketUser(DiscordSocketClient discord, ulong id)
: base(discord, id)
: base(discord, id)
@@ -55,13 +57,11 @@ namespace Discord.WebSocket
=> Task.FromResult<IDMChannel>(GlobalUser.DMChannel);
=> Task.FromResult<IDMChannel>(GlobalUser.DMChannel);
async Task<IDMChannel> IUser.CreateDMChannelAsync(RequestOptions options)
async Task<IDMChannel> IUser.CreateDMChannelAsync(RequestOptions options)
=> await CreateDMChannelAsync(options).ConfigureAwait(false);
=> await CreateDMChannelAsync(options).ConfigureAwait(false);
public async Task AddFriendAsync(RequestOptions options = null)
public async Task AddFriendAsync(RequestOptions options = null)
=> await Discord.ApiClient.AddFriendAsync(Id, options);
=> await Discord.ApiClient.AddFriendAsync(Id, options);
public async Task BlockUserAsync(RequestOptions options = null)
public async Task BlockUserAsync(RequestOptions options = null)
=> await Discord.ApiClient.BlockUserAsync(Id, options);
=> await Discord.ApiClient.BlockUserAsync(Id, options);
public async Task RemoveRelationshipAsync(RequestOptions options = null)
public async Task RemoveRelationshipAsync(RequestOptions options = null)
=> await Discord.ApiClient.RemoveRelationshipAsync(Id, options);
=> await Discord.ApiClient.RemoveRelationshipAsync(Id, options);
}
}