@@ -40,6 +40,7 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Parses a provided user mention string. | /// Parses a provided user mention string. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="text">The user mention.</param> | |||||
/// <exception cref="ArgumentException">Invalid mention format.</exception> | /// <exception cref="ArgumentException">Invalid mention format.</exception> | ||||
public static ulong ParseUser(string text) | public static ulong ParseUser(string text) | ||||
{ | { | ||||
@@ -50,6 +51,8 @@ namespace Discord | |||||
/// <summary> | /// <summary> | ||||
/// Tries to parse a provided user mention string. | /// Tries to parse a provided user mention string. | ||||
/// </summary> | /// </summary> | ||||
/// <param name="text">The user mention.</param> | |||||
/// <param name="userId">The UserId of the user.</param> | |||||
public static bool TryParseUser(string text, out ulong userId) | public static bool TryParseUser(string text, out ulong userId) | ||||
{ | { | ||||
if (text.Length >= 3 && text[0] == '<' && text[1] == '@' && text[text.Length - 1] == '>') | if (text.Length >= 3 && text[0] == '<' && text[1] == '@' && text[text.Length - 1] == '>') | ||||
@@ -2,10 +2,20 @@ using Newtonsoft.Json; | |||||
namespace Discord.API | namespace Discord.API | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a vanity invite. | |||||
/// </summary> | |||||
public class InviteVanity | public class InviteVanity | ||||
{ | { | ||||
/// <summary> | |||||
/// The unique code for the invite link. | |||||
/// </summary> | |||||
[JsonProperty("code")] | [JsonProperty("code")] | ||||
public string Code { get; set; } | public string Code { get; set; } | ||||
/// <summary> | |||||
/// The total amount of vanity invite uses. | |||||
/// </summary> | |||||
[JsonProperty("uses")] | [JsonProperty("uses")] | ||||
public int Uses { get; set; } | public int Uses { get; set; } | ||||
} | } | ||||
@@ -44,7 +44,7 @@ namespace Discord.WebSocket | |||||
/// Sends a file to this message channel with an optional caption. | /// Sends a file to this message channel with an optional caption. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference)"/>. | |||||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent)"/>. | |||||
/// Please visit its documentation for more details on this method. | /// Please visit its documentation for more details on this method. | ||||
/// </remarks> | /// </remarks> | ||||
/// <param name="filePath">The file path of the file.</param> | /// <param name="filePath">The file path of the file.</param> | ||||
@@ -68,7 +68,7 @@ namespace Discord.WebSocket | |||||
/// Sends a file to this message channel with an optional caption. | /// Sends a file to this message channel with an optional caption. | ||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference)"/>. | |||||
/// This method follows the same behavior as described in <see cref="IMessageChannel.SendFileAsync(Stream, string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent)"/>. | |||||
/// Please visit its documentation for more details on this method. | /// Please visit its documentation for more details on this method. | ||||
/// </remarks> | /// </remarks> | ||||
/// <param name="stream">The <see cref="Stream" /> of the file to be sent.</param> | /// <param name="stream">The <see cref="Stream" /> of the file to be sent.</param> | ||||
@@ -31,7 +31,15 @@ namespace Discord.WebSocket | |||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public IReadOnlyCollection<SocketMessage> CachedMessages => _messages?.Messages ?? ImmutableArray.Create<SocketMessage>(); | public IReadOnlyCollection<SocketMessage> CachedMessages => _messages?.Messages ?? ImmutableArray.Create<SocketMessage>(); | ||||
/// <summary> | |||||
/// Returns a collection representing all of the users in the group. | |||||
/// </summary> | |||||
public new IReadOnlyCollection<SocketGroupUser> Users => _users.ToReadOnlyCollection(); | public new IReadOnlyCollection<SocketGroupUser> Users => _users.ToReadOnlyCollection(); | ||||
/// <summary> | |||||
/// Returns a collection representing all users in the group, not including the client. | |||||
/// </summary> | |||||
public IReadOnlyCollection<SocketGroupUser> Recipients | public IReadOnlyCollection<SocketGroupUser> Recipients | ||||
=> _users.Select(x => x.Value).Where(x => x.Id != Discord.CurrentUser.Id).ToReadOnlyCollection(() => _users.Count - 1); | => _users.Select(x => x.Value).Where(x => x.Id != Discord.CurrentUser.Id).ToReadOnlyCollection(() => _users.Count - 1); | ||||
@@ -6,6 +6,9 @@ using Model = Discord.API.Gateway.InviteCreateEvent; | |||||
namespace Discord.WebSocket | namespace Discord.WebSocket | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a WebSocket-based invite to a guild. | |||||
/// </summary> | |||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class SocketInvite : SocketEntity<string>, IInviteMetadata | public class SocketInvite : SocketEntity<string>, IInviteMetadata | ||||
{ | { | ||||
@@ -50,6 +50,10 @@ namespace Discord.WebSocket | |||||
public bool IsEveryone => Id == Guild.Id; | public bool IsEveryone => Id == Guild.Id; | ||||
/// <inheritdoc /> | /// <inheritdoc /> | ||||
public string Mention => IsEveryone ? "@everyone" : MentionUtils.MentionRole(Id); | public string Mention => IsEveryone ? "@everyone" : MentionUtils.MentionRole(Id); | ||||
/// <summary> | |||||
/// Returns an IEnumerable containing all <see cref="SocketGuildUser"/> that have this role. | |||||
/// </summary> | |||||
public IEnumerable<SocketGuildUser> Members | public IEnumerable<SocketGuildUser> Members | ||||
=> Guild.Users.Where(x => x.Roles.Any(r => r.Id == Id)); | => Guild.Users.Where(x => x.Roles.Any(r => r.Id == Id)); | ||||
@@ -3,6 +3,9 @@ using Model = Discord.API.User; | |||||
namespace Discord.WebSocket | namespace Discord.WebSocket | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a WebSocket-based group user. | |||||
/// </summary> | |||||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | [DebuggerDisplay("{DebuggerDisplay,nq}")] | ||||
public class SocketGroupUser : SocketUser, IGroupUser | public class SocketGroupUser : SocketUser, IGroupUser | ||||
{ | { | ||||