| @@ -3,13 +3,13 @@ namespace Discord | |||
| /// <summary> Specifies the connection state of a client. </summary> | |||
| public enum ConnectionState : byte | |||
| { | |||
| /// <summary> Represents that the client has disconnected from the WebSocket. </summary> | |||
| /// <summary> The client has disconnected from Discord. </summary> | |||
| Disconnected, | |||
| /// <summary> Represents that the client is connecting to the WebSocket. </summary> | |||
| /// <summary> The client is connecting to Discord. </summary> | |||
| Connecting, | |||
| /// <summary> Represents that the client has established a connection to the WebSocket. </summary> | |||
| /// <summary> The client has established a connection to Discord. </summary> | |||
| Connected, | |||
| /// <summary> Represents that the client is disconnecting from the WebSocket. </summary> | |||
| /// <summary> The client is disconnecting from Discord. </summary> | |||
| Disconnecting | |||
| } | |||
| } | |||
| @@ -3,13 +3,13 @@ namespace Discord | |||
| /// <summary> Specifies a Discord user's activity type. </summary> | |||
| public enum ActivityType | |||
| { | |||
| /// <summary> Represents that the user is playing a game. </summary> | |||
| /// <summary> The user is playing a game. </summary> | |||
| Playing = 0, | |||
| /// <summary> Represents that the user is streaming online. </summary> | |||
| /// <summary> The user is streaming online. </summary> | |||
| Streaming = 1, | |||
| /// <summary> Represents that the user is listening to a song. </summary> | |||
| /// <summary> The user is listening to a song. </summary> | |||
| Listening = 2, | |||
| /// <summary> Represents that the user is watching a media. </summary> | |||
| /// <summary> The user is watching a media. </summary> | |||
| Watching = 3 | |||
| } | |||
| } | |||
| @@ -26,7 +26,7 @@ namespace Discord | |||
| SendTTSMessages = 0x00_00_10_00, | |||
| /// <summary> Allows for deletion of other users messages. </summary> | |||
| ManageMessages = 0x00_00_20_00, | |||
| /// <summary> Links sent by users with this permission will be auto-embedded. </summary> | |||
| /// <summary> Allows links sent by users with this permission will be auto-embedded. </summary> | |||
| EmbedLinks = 0x00_00_40_00, | |||
| /// <summary> Allows for uploading images and files. </summary> | |||
| AttachFiles = 0x00_00_80_00, | |||
| @@ -1,28 +1,20 @@ | |||
| using System; | |||
| using System; | |||
| using System.Threading.Tasks; | |||
| namespace Discord | |||
| { | |||
| /// <summary> | |||
| /// Contains an entity that may be cached. | |||
| /// </summary> | |||
| /// <typeparam name="TEntity">The type of entity that is cached</typeparam> | |||
| /// <typeparam name="TId">The type of this entity's ID</typeparam> | |||
| /// <summary> Contains an entity that may be cached. </summary> | |||
| /// <typeparam name="TEntity"> The type of entity that is cached. </typeparam> | |||
| /// <typeparam name="TId"> The type of this entity's ID. </typeparam> | |||
| public struct Cacheable<TEntity, TId> | |||
| where TEntity : IEntity<TId> | |||
| where TId : IEquatable<TId> | |||
| { | |||
| /// <summary> | |||
| /// Is this entity cached? | |||
| /// </summary> | |||
| /// <summary> Indicates whether this entity is cached. </summary> | |||
| public bool HasValue { get; } | |||
| /// <summary> | |||
| /// The ID of this entity. | |||
| /// </summary> | |||
| /// <summary> Gets the ID of this entity. </summary> | |||
| public TId Id { get; } | |||
| /// <summary> | |||
| /// The entity, if it could be pulled from cache. | |||
| /// </summary> | |||
| /// <summary> Gets the entity if it could be pulled from cache. </summary> | |||
| /// <remarks> | |||
| /// This value is not guaranteed to be set; in cases where the entity cannot be pulled from cache, it is null. | |||
| /// </remarks> | |||
| @@ -37,9 +29,7 @@ namespace Discord | |||
| DownloadFunc = downloadFunc; | |||
| } | |||
| /// <summary> | |||
| /// Downloads this entity to cache. | |||
| /// </summary> | |||
| /// <summary> Downloads this entity to cache. </summary> | |||
| /// <returns>An awaitable Task containing the downloaded entity.</returns> | |||
| /// <exception cref="Discord.Net.HttpException">Thrown when used from a user account.</exception> | |||
| /// <exception cref="NullReferenceException">Thrown when the message is deleted.</exception> | |||
| @@ -48,12 +38,10 @@ namespace Discord | |||
| return await DownloadFunc(); | |||
| } | |||
| /// <summary> | |||
| /// Returns the cached entity if it exists; otherwise downloads it. | |||
| /// </summary> | |||
| /// <summary> Returns the cached entity if it exists; otherwise downloads it. </summary> | |||
| /// <returns>An awaitable Task containing a cached or downloaded entity.</returns> | |||
| /// <exception cref="Discord.Net.HttpException">Thrown when used from a user account.</exception> | |||
| /// <exception cref="NullReferenceException">Thrown when the message is deleted and is not in cache.</exception> | |||
| public async Task<TEntity> GetOrDownloadAsync() => HasValue ? Value : await DownloadAsync(); | |||
| } | |||
| } | |||
| } | |||
| @@ -3,15 +3,15 @@ namespace Discord | |||
| /// <summary> Defines the types of channels. </summary> | |||
| public enum ChannelType | |||
| { | |||
| /// <summary> Represents a text channel. </summary> | |||
| /// <summary> The channel is a text channel. </summary> | |||
| Text = 0, | |||
| /// <summary> Represents a Direct Message channel. </summary> | |||
| /// <summary> The channel is a Direct Message channel. </summary> | |||
| DM = 1, | |||
| /// <summary> Represents a voice channel. </summary> | |||
| /// <summary> The channel is a voice channel. </summary> | |||
| Voice = 2, | |||
| /// <summary> Represents a group channel. </summary> | |||
| /// <summary> The channel is a group channel. </summary> | |||
| Group = 3, | |||
| /// <summary> Represents a category channel. </summary> | |||
| /// <summary> The channel is a category channel. </summary> | |||
| Category = 4 | |||
| } | |||
| } | |||