diff --git a/src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs b/src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs
index e502d2287..c66662ef1 100644
--- a/src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs
+++ b/src/Discord.Net.Core/Entities/Channels/IGuildChannel.cs
@@ -4,13 +4,13 @@ using System.Threading.Tasks;
namespace Discord
{
- /// Represents a guild channel. This includes a text channel, voice channel, and category channel.
+ /// Represents a guild channel (text, voice, category).
public interface IGuildChannel : IChannel, IDeletable
{
/// Gets the position of this channel in the guild's channel list, relative to others of the same type.
int Position { get; }
- /// Gets the parentid (category) of this channel in the guild's channel list.
+ /// Gets the parent ID (category) of this channel in the guild's channel list.
ulong? CategoryId { get; }
/// Gets the parent channel (category) of this channel.
Task GetCategoryAsync();
diff --git a/src/Discord.Net.Core/Entities/Channels/ReorderChannelProperties.cs b/src/Discord.Net.Core/Entities/Channels/ReorderChannelProperties.cs
index 31f814334..62d35a15f 100644
--- a/src/Discord.Net.Core/Entities/Channels/ReorderChannelProperties.cs
+++ b/src/Discord.Net.Core/Entities/Channels/ReorderChannelProperties.cs
@@ -1,12 +1,16 @@
-namespace Discord
+namespace Discord
{
+ /// Properties that are used to reorder an .
public class ReorderChannelProperties
{
- /// The id of the channel to apply this position to.
+ /// Gets the ID of the channel to apply this position to.
public ulong Id { get; }
- /// The new zero-based position of this channel.
+ /// Gets the new zero-based position of this channel.
public int Position { get; }
+ /// Creates a used to reorder a channel.
+ /// Sets the ID of the channel to apply this position to.
+ /// Sets the new zero-based position of this channel.
public ReorderChannelProperties(ulong id, int position)
{
Id = id;
diff --git a/src/Discord.Net.Core/Entities/Users/IGuildUser.cs b/src/Discord.Net.Core/Entities/Users/IGuildUser.cs
index 97ef7d5c1..c6c9fabd5 100644
--- a/src/Discord.Net.Core/Entities/Users/IGuildUser.cs
+++ b/src/Discord.Net.Core/Entities/Users/IGuildUser.cs
@@ -22,20 +22,26 @@ namespace Discord
IReadOnlyCollection RoleIds { get; }
/// Gets the level permissions granted to this user to a given channel.
+ /// The channel to get the permission from.
ChannelPermissions GetPermissions(IGuildChannel channel);
/// Kicks this user from this guild.
+ /// The reason for the kick which will be recorded in the audit log.
Task KickAsync(string reason = null, RequestOptions options = null);
/// Modifies this user's properties in this guild.
Task ModifyAsync(Action func, RequestOptions options = null);
/// Adds a role to this user in this guild.
+ /// The role to be added to the user.
Task AddRoleAsync(IRole role, RequestOptions options = null);
/// Adds roles to this user in this guild.
+ /// The roles to be added to the user.
Task AddRolesAsync(IEnumerable roles, RequestOptions options = null);
/// Removes a role from this user in this guild.
+ /// The role to be removed from the user.
Task RemoveRoleAsync(IRole role, RequestOptions options = null);
/// Removes roles from this user in this guild.
+ /// The roles to be removed from the user.
Task RemoveRolesAsync(IEnumerable roles, RequestOptions options = null);
}
}
diff --git a/src/Discord.Net.Core/Entities/Users/IVoiceState.cs b/src/Discord.Net.Core/Entities/Users/IVoiceState.cs
index 428601f2a..fc7855975 100644
--- a/src/Discord.Net.Core/Entities/Users/IVoiceState.cs
+++ b/src/Discord.Net.Core/Entities/Users/IVoiceState.cs
@@ -1,16 +1,16 @@
-namespace Discord
+namespace Discord
{
public interface IVoiceState
{
- /// Returns true if the guild has deafened this user.
+ /// Returns if the guild has deafened this user.
bool IsDeafened { get; }
- /// Returns true if the guild has muted this user.
+ /// Returns if the guild has muted this user.
bool IsMuted { get; }
- /// Returns true if this user has marked themselves as deafened.
+ /// Returns if this user has marked themselves as deafened.
bool IsSelfDeafened { get; }
- /// Returns true if this user has marked themselves as muted.
+ /// Returns if this user has marked themselves as muted.
bool IsSelfMuted { get; }
- /// Returns true if the guild is temporarily blocking audio to/from this user.
+ /// Returns if the guild is temporarily blocking audio to/from this user.
bool IsSuppressed { get; }
/// Gets the voice channel this user is currently in, if any.
IVoiceChannel VoiceChannel { get; }
diff --git a/src/Discord.Net.Core/Extensions/DiscordClientExtensions.cs b/src/Discord.Net.Core/Extensions/DiscordClientExtensions.cs
index 03d736c6e..c38fa8e00 100644
--- a/src/Discord.Net.Core/Extensions/DiscordClientExtensions.cs
+++ b/src/Discord.Net.Core/Extensions/DiscordClientExtensions.cs
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
namespace Discord
{
- /// Extensions for .
+ /// An extension class for the Discord client.
public static class DiscordClientExtensions
{
/// Gets the private channel with the provided ID.
diff --git a/src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs b/src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs
index 90eaf90ad..b650aa401 100644
--- a/src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs
+++ b/src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs
@@ -2,7 +2,7 @@ using System;
namespace Discord
{
- /// Extensions for building an embed.
+ /// An extension class for building an embed.
public static class EmbedBuilderExtensions
{
/// Adds embed color based on the provided raw value.
diff --git a/src/Discord.Net.Core/Extensions/UserExtensions.cs b/src/Discord.Net.Core/Extensions/UserExtensions.cs
index d3e968e39..ad00296f7 100644
--- a/src/Discord.Net.Core/Extensions/UserExtensions.cs
+++ b/src/Discord.Net.Core/Extensions/UserExtensions.cs
@@ -3,11 +3,10 @@ using System.IO;
namespace Discord
{
+ /// An extension class for various Discord user objects.
public static class UserExtensions
{
- ///
- /// Sends a message to the user via DM.
- ///
+ /// Sends a message to the user via DM.
public static async Task SendMessageAsync(this IUser user,
string text,
bool isTTS = false,
@@ -17,9 +16,7 @@ namespace Discord
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(text, isTTS, embed, options).ConfigureAwait(false);
}
- ///
- /// Sends a file to the user via DM.
- ///
+ /// Sends a file to the user via DM.
public static async Task SendFileAsync(this IUser user,
Stream stream,
string filename,
@@ -33,9 +30,7 @@ namespace Discord
}
#if FILESYSTEM
- ///
- /// Sends a file to the user via DM.
- ///
+ /// Sends a file to the user via DM.
public static async Task SendFileAsync(this IUser user,
string filePath,
string text = null,
@@ -46,7 +41,10 @@ namespace Discord
return await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, text, isTTS, embed, options).ConfigureAwait(false);
}
#endif
-
+ /// Bans the provided user from the guild and optionally prunes their recent messages.
+ /// The user to ban.
+ /// The number of days to remove messages from this user for - must be between [0, 7]
+ /// The reason of the ban to be written in the audit log.
public static Task BanAsync(this IGuildUser user, int pruneDays = 0, string reason = null, RequestOptions options = null)
=> user.Guild.AddBanAsync(user, pruneDays, reason, options);
}
diff --git a/src/Discord.Net.Rest/Entities/Users/RestGroupUser.cs b/src/Discord.Net.Rest/Entities/Users/RestGroupUser.cs
index 951bd2e7c..0ad0d8175 100644
--- a/src/Discord.Net.Rest/Entities/Users/RestGroupUser.cs
+++ b/src/Discord.Net.Rest/Entities/Users/RestGroupUser.cs
@@ -1,4 +1,4 @@
-using System.Diagnostics;
+using System.Diagnostics;
using Model = Discord.API.User;
namespace Discord.Rest
@@ -16,14 +16,21 @@ namespace Discord.Rest
entity.Update(model);
return entity;
}
-
+
//IVoiceState
+ ///
bool IVoiceState.IsDeafened => false;
+ ///
bool IVoiceState.IsMuted => false;
+ ///
bool IVoiceState.IsSelfDeafened => false;
+ ///
bool IVoiceState.IsSelfMuted => false;
+ ///
bool IVoiceState.IsSuppressed => false;
+ ///
IVoiceChannel IVoiceState.VoiceChannel => null;
+ ///
string IVoiceState.VoiceSessionId => null;
}
}
diff --git a/src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs b/src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs
index e571f8f73..051ed73d5 100644
--- a/src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs
+++ b/src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
@@ -14,12 +14,17 @@ namespace Discord.Rest
private long? _joinedAtTicks;
private ImmutableArray _roleIds;
+ ///
public string Nickname { get; private set; }
internal IGuild Guild { get; private set; }
+ ///
public bool IsDeafened { get; private set; }
+ ///
public bool IsMuted { get; private set; }
+ ///
public ulong GuildId => Guild.Id;
+ ///
public GuildPermissions GuildPermissions
{
get
@@ -29,8 +34,10 @@ namespace Discord.Rest
return new GuildPermissions(Permissions.ResolveGuild(Guild, this));
}
}
+ ///
public IReadOnlyCollection RoleIds => _roleIds;
+ ///
public DateTimeOffset? JoinedAt => DateTimeUtils.FromTicks(_joinedAtTicks);
internal RestGuildUser(BaseDiscordClient discord, IGuild guild, ulong id)
@@ -67,11 +74,13 @@ namespace Discord.Rest
_roleIds = roles.ToImmutable();
}
+ ///
public override async Task UpdateAsync(RequestOptions options = null)
{
var model = await Discord.ApiClient.GetGuildMemberAsync(GuildId, Id, options).ConfigureAwait(false);
Update(model);
}
+ ///
public async Task ModifyAsync(Action func, RequestOptions options = null)
{
var args = await UserHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false);
@@ -86,6 +95,7 @@ namespace Discord.Rest
else if (args.RoleIds.IsSpecified)
UpdateRoles(args.RoleIds.Value.ToArray());
}
+ ///
public Task KickAsync(string reason = null, RequestOptions options = null)
=> UserHelper.KickAsync(this, Discord, reason, options);
///
@@ -101,6 +111,7 @@ namespace Discord.Rest
public Task RemoveRolesAsync(IEnumerable roles, RequestOptions options = null)
=> UserHelper.RemoveRolesAsync(this, Discord, roles, options);
+ ///
public ChannelPermissions GetPermissions(IGuildChannel channel)
{
var guildPerms = GuildPermissions;
diff --git a/src/Discord.Net.Rest/Entities/Users/RestWebhookUser.cs b/src/Discord.Net.Rest/Entities/Users/RestWebhookUser.cs
index bb44f2777..5070d1b6e 100644
--- a/src/Discord.Net.Rest/Entities/Users/RestWebhookUser.cs
+++ b/src/Discord.Net.Rest/Entities/Users/RestWebhookUser.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
@@ -10,10 +10,13 @@ namespace Discord.Rest
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class RestWebhookUser : RestUser, IWebhookUser
{
+ ///
public ulong WebhookId { get; }
internal IGuild Guild { get; }
+ ///
public override bool IsWebhook => true;
+ ///
public ulong GuildId => Guild.Id;
internal RestWebhookUser(BaseDiscordClient discord, IGuild guild, ulong id, ulong webhookId)
@@ -28,8 +31,9 @@ namespace Discord.Rest
entity.Update(model);
return entity;
}
-
+
//IGuildUser
+ ///
IGuild IGuildUser.Guild
{
get
@@ -39,45 +43,63 @@ namespace Discord.Rest
throw new InvalidOperationException("Unable to return this entity's parent unless it was fetched through that object.");
}
}
+ ///
IReadOnlyCollection IGuildUser.RoleIds => ImmutableArray.Create();
+ ///
DateTimeOffset? IGuildUser.JoinedAt => null;
+ ///
string IGuildUser.Nickname => null;
+ ///
GuildPermissions IGuildUser.GuildPermissions => GuildPermissions.Webhook;
+ ///
ChannelPermissions IGuildUser.GetPermissions(IGuildChannel channel) => Permissions.ToChannelPerms(channel, GuildPermissions.Webhook.RawValue);
+ ///
Task IGuildUser.KickAsync(string reason, RequestOptions options)
{
throw new NotSupportedException("Webhook users cannot be kicked.");
}
+ ///
Task IGuildUser.ModifyAsync(Action func, RequestOptions options)
{
throw new NotSupportedException("Webhook users cannot be modified.");
}
+ ///
Task IGuildUser.AddRoleAsync(IRole role, RequestOptions options)
{
throw new NotSupportedException("Roles are not supported on webhook users.");
}
+ ///
Task IGuildUser.AddRolesAsync(IEnumerable roles, RequestOptions options)
{
throw new NotSupportedException("Roles are not supported on webhook users.");
}
+ ///
Task IGuildUser.RemoveRoleAsync(IRole role, RequestOptions options)
{
throw new NotSupportedException("Roles are not supported on webhook users.");
}
+ ///
Task IGuildUser.RemoveRolesAsync(IEnumerable roles, RequestOptions options)
{
throw new NotSupportedException("Roles are not supported on webhook users.");
}
//IVoiceState
+ ///
bool IVoiceState.IsDeafened => false;
+ ///
bool IVoiceState.IsMuted => false;
+ ///
bool IVoiceState.IsSelfDeafened => false;
+ ///
bool IVoiceState.IsSelfMuted => false;
+ ///
bool IVoiceState.IsSuppressed => false;
+ ///
IVoiceChannel IVoiceState.VoiceChannel => null;
+ ///
string IVoiceState.VoiceSessionId => null;
}
}
diff --git a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
index 2163daf55..84072a2ab 100644
--- a/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
+++ b/src/Discord.Net.WebSocket/Entities/Channels/SocketGuildChannel.cs
@@ -1,4 +1,4 @@
-using Discord.Rest;
+using Discord.Rest;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -9,18 +9,23 @@ using Model = Discord.API.Channel;
namespace Discord.WebSocket
{
+ /// The WebSocket variant of . Represents a guild channel (text, voice, category).
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketGuildChannel : SocketChannel, IGuildChannel
{
private ImmutableArray _overwrites;
public SocketGuild Guild { get; }
+ ///
public string Name { get; private set; }
+ ///
public int Position { get; private set; }
+ ///
public ulong? CategoryId { get; private set; }
public ICategoryChannel Category
=> CategoryId.HasValue ? Guild.GetChannel(CategoryId.Value) as ICategoryChannel : null;
+ ///
public IReadOnlyCollection PermissionOverwrites => _overwrites;
public new virtual IReadOnlyCollection Users => ImmutableArray.Create();
@@ -57,8 +62,10 @@ namespace Discord.WebSocket
_overwrites = newOverwrites.ToImmutable();
}
+ ///
public Task ModifyAsync(Action func, RequestOptions options = null)
=> ChannelHelper.ModifyAsync(this, Discord, func, options);
+ ///
public Task DeleteAsync(RequestOptions options = null)
=> ChannelHelper.DeleteAsync(this, Discord, options);
@@ -132,38 +139,53 @@ namespace Discord.WebSocket
internal override SocketUser GetUserInternal(ulong id) => GetUser(id);
//IGuildChannel
+ ///
IGuild IGuildChannel.Guild => Guild;
+ ///
ulong IGuildChannel.GuildId => Guild.Id;
+ ///
Task IGuildChannel.GetCategoryAsync()
=> Task.FromResult(Category);
+ ///
async Task> IGuildChannel.GetInvitesAsync(RequestOptions options)
=> await GetInvitesAsync(options).ConfigureAwait(false);
+ ///
async Task IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options)
=> await CreateInviteAsync(maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false);
+ ///
OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IRole role)
=> GetPermissionOverwrite(role);
+ ///
OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IUser user)
=> GetPermissionOverwrite(user);
+ ///
async Task IGuildChannel.AddPermissionOverwriteAsync(IRole role, OverwritePermissions permissions, RequestOptions options)
=> await AddPermissionOverwriteAsync(role, permissions, options).ConfigureAwait(false);
+ ///
async Task IGuildChannel.AddPermissionOverwriteAsync(IUser user, OverwritePermissions permissions, RequestOptions options)
=> await AddPermissionOverwriteAsync(user, permissions, options).ConfigureAwait(false);
+ ///
async Task IGuildChannel.RemovePermissionOverwriteAsync(IRole role, RequestOptions options)
=> await RemovePermissionOverwriteAsync(role, options).ConfigureAwait(false);
+ ///
async Task IGuildChannel.RemovePermissionOverwriteAsync(IUser user, RequestOptions options)
=> await RemovePermissionOverwriteAsync(user, options).ConfigureAwait(false);
+ ///
IAsyncEnumerable> IGuildChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> ImmutableArray.Create>(Users).ToAsyncEnumerable();
+ ///
Task IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> Task.FromResult(GetUser(id));
//IChannel
+ ///
IAsyncEnumerable> IChannel.GetUsersAsync(CacheMode mode, RequestOptions options)
=> ImmutableArray.Create>(Users).ToAsyncEnumerable(); //Overridden in Text/Voice
+ ///
Task IChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
=> Task.FromResult(GetUser(id)); //Overridden in Text/Voice
}
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketGroupUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketGroupUser.cs
index 8d1b360e3..10701b418 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketGroupUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketGroupUser.cs
@@ -1,4 +1,4 @@
-using System.Diagnostics;
+using System.Diagnostics;
using Model = Discord.API.User;
namespace Discord.WebSocket
@@ -9,12 +9,17 @@ namespace Discord.WebSocket
public SocketGroupChannel Channel { get; }
internal override SocketGlobalUser GlobalUser { get; }
+ ///
public override bool IsBot { get { return GlobalUser.IsBot; } internal set { GlobalUser.IsBot = value; } }
+ ///
public override string Username { get { return GlobalUser.Username; } internal set { GlobalUser.Username = value; } }
+ ///
public override ushort DiscriminatorValue { get { return GlobalUser.DiscriminatorValue; } internal set { GlobalUser.DiscriminatorValue = value; } }
+ ///
public override string AvatarId { get { return GlobalUser.AvatarId; } internal set { GlobalUser.AvatarId = value; } }
internal override SocketPresence Presence { get { return GlobalUser.Presence; } set { GlobalUser.Presence = value; } }
+ ///
public override bool IsWebhook => false;
internal SocketGroupUser(SocketGroupChannel channel, SocketGlobalUser globalUser)
@@ -33,12 +38,19 @@ namespace Discord.WebSocket
internal new SocketGroupUser Clone() => MemberwiseClone() as SocketGroupUser;
//IVoiceState
+ ///
bool IVoiceState.IsDeafened => false;
+ ///
bool IVoiceState.IsMuted => false;
+ ///
bool IVoiceState.IsSelfDeafened => false;
+ ///
bool IVoiceState.IsSelfMuted => false;
+ ///
bool IVoiceState.IsSuppressed => false;
+ ///
IVoiceChannel IVoiceState.VoiceChannel => null;
+ ///
string IVoiceState.VoiceSessionId => null;
}
}
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs
index 66af20bb6..cad354dae 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs
@@ -1,4 +1,4 @@
-using Discord.Audio;
+using Discord.Audio;
using Discord.Rest;
using System;
using System.Collections.Generic;
@@ -12,6 +12,7 @@ using PresenceModel = Discord.API.Presence;
namespace Discord.WebSocket
{
+ /// The WebSocket variant of . Represents a Discord user that is in a guild.
[DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public class SocketGuildUser : SocketUser, IGuildUser
{
@@ -20,32 +21,46 @@ namespace Discord.WebSocket
internal override SocketGlobalUser GlobalUser { get; }
public SocketGuild Guild { get; }
+ ///
public string Nickname { get; private set; }
+ ///
public override bool IsBot { get { return GlobalUser.IsBot; } internal set { GlobalUser.IsBot = value; } }
+ ///
public override string Username { get { return GlobalUser.Username; } internal set { GlobalUser.Username = value; } }
+ ///
public override ushort DiscriminatorValue { get { return GlobalUser.DiscriminatorValue; } internal set { GlobalUser.DiscriminatorValue = value; } }
+ ///
public override string AvatarId { get { return GlobalUser.AvatarId; } internal set { GlobalUser.AvatarId = value; } }
+ ///
public GuildPermissions GuildPermissions => new GuildPermissions(Permissions.ResolveGuild(Guild, this));
internal override SocketPresence Presence { get; set; }
+ ///
public override bool IsWebhook => false;
+ ///
public bool IsSelfDeafened => VoiceState?.IsSelfDeafened ?? false;
+ ///
public bool IsSelfMuted => VoiceState?.IsSelfMuted ?? false;
+ ///
public bool IsSuppressed => VoiceState?.IsSuppressed ?? false;
+ ///
public bool IsDeafened => VoiceState?.IsDeafened ?? false;
+ ///
public bool IsMuted => VoiceState?.IsMuted ?? false;
+ ///
public DateTimeOffset? JoinedAt => DateTimeUtils.FromTicks(_joinedAtTicks);
public IReadOnlyCollection Roles
=> _roleIds.Select(id => Guild.GetRole(id)).Where(x => x != null).ToReadOnlyCollection(() => _roleIds.Length);
public SocketVoiceChannel VoiceChannel => VoiceState?.VoiceChannel;
+ ///
public string VoiceSessionId => VoiceState?.VoiceSessionId ?? "";
public SocketVoiceState? VoiceState => Guild.GetVoiceState(Id);
public AudioInStream AudioStream => Guild.GetAudioStream(Id);
/// The position of the user within the role hierarchy.
/// The returned value equal to the position of the highest role the user has,
- /// or int.MaxValue if user is the server owner.
+ /// or if user is the server owner.
public int Hierarchy
{
get
@@ -119,9 +134,11 @@ namespace Discord.WebSocket
roles.Add(roleIds[i]);
_roleIds = roles.ToImmutable();
}
-
+
+ ///
public Task ModifyAsync(Action func, RequestOptions options = null)
=> UserHelper.ModifyAsync(this, Discord, func, options);
+ ///
public Task KickAsync(string reason = null, RequestOptions options = null)
=> UserHelper.KickAsync(this, Discord, reason, options);
///
@@ -137,17 +154,22 @@ namespace Discord.WebSocket
public Task RemoveRolesAsync(IEnumerable roles, RequestOptions options = null)
=> UserHelper.RemoveRolesAsync(this, Discord, roles, options);
+ ///
public ChannelPermissions GetPermissions(IGuildChannel channel)
=> new ChannelPermissions(Permissions.ResolveChannel(Guild, this, channel, GuildPermissions.RawValue));
internal new SocketGuildUser Clone() => MemberwiseClone() as SocketGuildUser;
//IGuildUser
+ ///
IGuild IGuildUser.Guild => Guild;
+ ///
ulong IGuildUser.GuildId => Guild.Id;
+ ///
IReadOnlyCollection IGuildUser.RoleIds => _roleIds;
-
+
//IVoiceState
+ ///
IVoiceChannel IVoiceState.VoiceChannel => VoiceChannel;
}
}
diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
index 58d5c62a1..5c255f3a0 100644
--- a/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
+++ b/src/Discord.Net.WebSocket/Entities/Users/SocketUser.cs
@@ -1,24 +1,35 @@
-using Discord.Rest;
+using Discord.Rest;
using System;
using System.Threading.Tasks;
using Model = Discord.API.User;
namespace Discord.WebSocket
{
+ /// The WebSocket variant of . Represents a Discord user.
public abstract class SocketUser : SocketEntity, IUser
{
+ ///
public abstract bool IsBot { get; internal set; }
+ ///
public abstract string Username { get; internal set; }
+ ///
public abstract ushort DiscriminatorValue { get; internal set; }
+ ///
public abstract string AvatarId { get; internal set; }
+ ///
public abstract bool IsWebhook { get; }
internal abstract SocketGlobalUser GlobalUser { get; }
internal abstract SocketPresence Presence { get; set; }
+ ///
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
+ ///
public string Discriminator => DiscriminatorValue.ToString("D4");
+ ///
public string Mention => MentionUtils.MentionUser(Id);
+ ///
public IActivity Activity => Presence.Activity;
+ ///
public UserStatus Status => Presence.Status;
internal SocketUser(DiscordSocketClient discord, ulong id)
@@ -53,14 +64,17 @@ namespace Discord.WebSocket
hasChanges = true;
}
return hasChanges;
- }
+ }
+ ///
public async Task GetOrCreateDMChannelAsync(RequestOptions options = null)
=> GlobalUser.DMChannel ?? await UserHelper.CreateDMChannelAsync(this, Discord, options) as IDMChannel;
+ ///
public string GetAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
=> CDN.GetUserAvatarUrl(Id, AvatarId, size, format);
+ /// Gets the username and the discriminator.
public override string ToString() => $"{Username}#{Discriminator}";
private string DebuggerDisplay => $"{Username}#{Discriminator} ({Id}{(IsBot ? ", Bot" : "")})";
internal SocketUser Clone() => MemberwiseClone() as SocketUser;