@@ -3,7 +3,7 @@ using System.Diagnostics; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// A user's game activity. | |||||
/// A user's game status. | |||||
/// </summary> | /// </summary> | ||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class Game : IActivity | public class Game : IActivity | ||||
@@ -1,7 +1,7 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// An asset for a <see cref="RichGame" /> object. | |||||
/// An asset for a <see cref="RichGame" /> object containing the text and image. | |||||
/// </summary> | /// </summary> | ||||
public class GameAsset | public class GameAsset | ||||
{ | { | ||||
@@ -1,11 +1,14 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | |||||
/// Party information for a <see cref="RichGame" /> object. | |||||
/// </summary> | |||||
public class GameParty | public class GameParty | ||||
{ | { | ||||
internal GameParty() { } | internal GameParty() { } | ||||
/// <summary> | /// <summary> | ||||
/// Gets the id of the party. | |||||
/// Gets the ID of the party. | |||||
/// </summary> | /// </summary> | ||||
public string Id { get; internal set; } | public string Id { get; internal set; } | ||||
public long Members { get; internal set; } | public long Members { get; internal set; } | ||||
@@ -1,5 +1,8 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | |||||
/// Party secret for a <see cref="RichGame" /> object. | |||||
/// </summary> | |||||
public class GameSecrets | public class GameSecrets | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
@@ -1,7 +1,7 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// A Discord activity, typically a game. | |||||
/// A user's activity status, typically a <see cref="Game"/>. | |||||
/// </summary> | /// </summary> | ||||
public interface IActivity | public interface IActivity | ||||
{ | { | ||||
@@ -2,6 +2,9 @@ using System.Diagnostics; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | |||||
/// A user's Rich Presence status. | |||||
/// </summary> | |||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class RichGame : Game | public class RichGame : Game | ||||
{ | { | ||||
@@ -1,13 +1,21 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Specifies the direction of where message(s) should be gotten from. </summary> | |||||
/// <summary> | |||||
/// Specifies the direction of where message(s) should be gotten from. | |||||
/// </summary> | |||||
public enum Direction | public enum Direction | ||||
{ | { | ||||
/// <summary> The message(s) should be retrieved before a message. </summary> | |||||
/// <summary> | |||||
/// The message(s) should be retrieved before a message. | |||||
/// </summary> | |||||
Before, | Before, | ||||
/// <summary> The message(s) should be retrieved after a message. </summary> | |||||
/// <summary> | |||||
/// The message(s) should be retrieved after a message. | |||||
/// </summary> | |||||
After, | After, | ||||
/// <summary> The message(s) should be retrieved around a message. </summary> | |||||
/// <summary> | |||||
/// The message(s) should be retrieved around a message. | |||||
/// </summary> | |||||
Around | Around | ||||
} | } | ||||
} | } |
@@ -1,7 +1,7 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Represents a generic category channel. | |||||
/// Represents a generic category channel. | |||||
/// </summary> | /// </summary> | ||||
public interface ICategoryChannel : IGuildChannel | public interface ICategoryChannel : IGuildChannel | ||||
{ | { | ||||
@@ -3,7 +3,7 @@ using System.Threading.Tasks; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Represents a generic group channel. | |||||
/// Represents a private generic group channel. | |||||
/// </summary> | /// </summary> | ||||
public interface IGroupChannel : IMessageChannel, IPrivateChannel, IAudioChannel | public interface IGroupChannel : IMessageChannel, IPrivateChannel, IAudioChannel | ||||
{ | { | ||||
@@ -16,12 +16,12 @@ namespace Discord | |||||
Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | Task<IUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
/// <summary> | /// <summary> | ||||
/// Sends a file to this <paramref name="text"/> channel, with an optional caption. | |||||
/// Sends a file to this message channel, with an optional caption. | |||||
/// </summary> | /// </summary> | ||||
Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | Task<IUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
#endif | #endif | ||||
/// <summary> | /// <summary> | ||||
/// Sends a file to this <paramref name="text"/> channel, with an optional caption. | |||||
/// Sends a file to this message channel, with an optional caption. | |||||
/// </summary> | /// </summary> | ||||
Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | Task<IUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
@@ -1,10 +1,19 @@ | |||||
using System.Collections.Generic; | |||||
using System.Collections.Generic; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | |||||
/// Properties that are used to modify an <see cref="Emote" /> with the specified changes. | |||||
/// </summary> | |||||
public class EmoteProperties | public class EmoteProperties | ||||
{ | { | ||||
/// <summary> | |||||
/// Gets or sets the name of the <see cref="Emote" /> . | |||||
/// </summary> | |||||
public Optional<string> Name { get; set; } | public Optional<string> Name { get; set; } | ||||
/// <summary> | |||||
/// Gets or sets the roles that can access this <see cref="Emote" /> . | |||||
/// </summary> | |||||
public Optional<IEnumerable<IRole>> Roles { get; set; } | public Optional<IEnumerable<IRole>> Roles { get; set; } | ||||
} | } | ||||
} | } |
@@ -9,8 +9,17 @@ namespace Discord | |||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class GuildEmote : Emote | public class GuildEmote : Emote | ||||
{ | { | ||||
/// <summary> | |||||
/// Gets whether this emoji is managed. | |||||
/// </summary> | |||||
public bool IsManaged { get; } | public bool IsManaged { get; } | ||||
/// <summary> | |||||
/// Gets whether this emoji must be wrapped in colons. | |||||
/// </summary> | |||||
public bool RequireColons { get; } | public bool RequireColons { get; } | ||||
/// <summary> | |||||
/// Gets the roles this emoji is whitelisted to. | |||||
/// </summary> | |||||
public IReadOnlyList<ulong> RoleIds { get; } | public IReadOnlyList<ulong> RoleIds { get; } | ||||
internal GuildEmote(ulong id, string name, bool animated, bool isManaged, bool requireColons, IReadOnlyList<ulong> roleIds) : base(id, name, animated) | internal GuildEmote(ulong id, string name, bool animated, bool isManaged, bool requireColons, IReadOnlyList<ulong> roleIds) : base(id, name, animated) | ||||
@@ -21,6 +30,9 @@ namespace Discord | |||||
} | } | ||||
private string DebuggerDisplay => $"{Name} ({Id})"; | private string DebuggerDisplay => $"{Name} ({Id})"; | ||||
/// <summary> | |||||
/// Gets the raw representation of the emoji. | |||||
/// </summary> | |||||
public override string ToString() => $"<{(Animated ? "a" : "")}:{Name}:{Id}>"; | public override string ToString() => $"<{(Animated ? "a" : "")}:{Name}:{Id}>"; | ||||
} | } | ||||
} | } |
@@ -1,13 +1,31 @@ | |||||
namespace Discord | |||||
namespace Discord | |||||
{ | { | ||||
/// <summary> | |||||
/// Represents a Discord application created via the developer portal. | |||||
/// </summary> | |||||
public interface IApplication : ISnowflakeEntity | public interface IApplication : ISnowflakeEntity | ||||
{ | { | ||||
/// <summary> | |||||
/// Gets the name of the application. | |||||
/// </summary> | |||||
string Name { get; } | string Name { get; } | ||||
/// <summary> | |||||
/// Gets the description of the application. | |||||
/// </summary> | |||||
string Description { get; } | string Description { get; } | ||||
/// <summary> | |||||
/// Gets the RPC origins of the application. | |||||
/// </summary> | |||||
string[] RPCOrigins { get; } | string[] RPCOrigins { get; } | ||||
ulong Flags { get; } | ulong Flags { get; } | ||||
/// <summary> | |||||
/// Gets the icon URL of the application. | |||||
/// </summary> | |||||
string IconUrl { get; } | string IconUrl { get; } | ||||
/// <summary> | |||||
/// Gets the partial user object containing info on the owner of the application. | |||||
/// </summary> | |||||
IUser Owner { get; } | IUser Owner { get; } | ||||
} | } | ||||
} | } |
@@ -2,7 +2,7 @@ using System; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Represents additional information regarding the invite object. </summary> | |||||
/// <summary> Represents additional information regarding the generic invite object. </summary> | |||||
public interface IInviteMetadata : IInvite | public interface IInviteMetadata : IInvite | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
@@ -1,4 +1,3 @@ | |||||
using System; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
namespace Discord | namespace Discord | ||||
@@ -1,4 +1,3 @@ | |||||
using System; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
namespace Discord | namespace Discord | ||||
@@ -1,4 +1,3 @@ | |||||
using System; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
namespace Discord | namespace Discord | ||||
@@ -1,4 +1,3 @@ | |||||
using System; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
namespace Discord | namespace Discord | ||||
@@ -1,4 +1,3 @@ | |||||
using System; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
namespace Discord | namespace Discord | ||||
@@ -1,25 +1,45 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Specifies the type of embed. </summary> | |||||
/// <summary> | |||||
/// Specifies the type of embed. | |||||
/// </summary> | |||||
public enum EmbedType | public enum EmbedType | ||||
{ | { | ||||
/// <summary> An unknown embed type. </summary> | |||||
/// <summary> | |||||
/// An unknown embed type. | |||||
/// </summary> | |||||
Unknown = -1, | Unknown = -1, | ||||
/// <summary> A rich embed type. </summary> | |||||
/// <summary> | |||||
/// A rich embed type. | |||||
/// </summary> | |||||
Rich, | Rich, | ||||
/// <summary> A link embed type. </summary> | |||||
/// <summary> | |||||
/// A link embed type. | |||||
/// </summary> | |||||
Link, | Link, | ||||
/// <summary> A video embed type. </summary> | |||||
/// <summary> | |||||
/// A video embed type. | |||||
/// </summary> | |||||
Video, | Video, | ||||
/// <summary> An image embed type. </summary> | |||||
/// <summary> | |||||
/// An image embed type. | |||||
/// </summary> | |||||
Image, | Image, | ||||
/// <summary> A GIFV embed type. </summary> | |||||
/// <summary> | |||||
/// A GIFV embed type. | |||||
/// </summary> | |||||
Gifv, | Gifv, | ||||
/// <summary> An article embed type. </summary> | |||||
/// <summary> | |||||
/// An article embed type. | |||||
/// </summary> | |||||
Article, | Article, | ||||
/// <summary> A tweet embed type. </summary> | |||||
/// <summary> | |||||
/// A tweet embed type. | |||||
/// </summary> | |||||
Tweet, | Tweet, | ||||
/// <summary> A HTML embed type. </summary> | |||||
/// <summary> | |||||
/// A HTML embed type. | |||||
/// </summary> | |||||
Html, | Html, | ||||
} | } | ||||
} | } |
@@ -1,17 +1,24 @@ | |||||
using System; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> A video featured in an <see cref="Embed"/>. </summary> | |||||
/// <summary> | |||||
/// A video featured in an <see cref="Embed" /> . | |||||
/// </summary> | |||||
[DebuggerDisplay("{DebuggerDisplay,nq}")] | [DebuggerDisplay("{DebuggerDisplay,nq}")] | ||||
public struct EmbedVideo | public struct EmbedVideo | ||||
{ | { | ||||
/// <summary> Gets the URL of the video. </summary> | |||||
/// <summary> | |||||
/// Gets the URL of the video. | |||||
/// </summary> | |||||
public string Url { get; } | public string Url { get; } | ||||
/// <summary> Gets the height of the video if there is any. </summary> | |||||
/// <summary> | |||||
/// Gets the height of the video, or <see langword="null"/> if none. | |||||
/// </summary> | |||||
public int? Height { get; } | public int? Height { get; } | ||||
/// <summary> Gets the weight of the video if there is any. </summary> | |||||
/// <summary> | |||||
/// Gets the weight of the video, or <see langword="null"/> if none. | |||||
/// </summary> | |||||
public int? Width { get; } | public int? Width { get; } | ||||
internal EmbedVideo(string url, int? height, int? width) | internal EmbedVideo(string url, int? height, int? width) | ||||
@@ -22,6 +29,9 @@ namespace Discord | |||||
} | } | ||||
private string DebuggerDisplay => $"{Url} ({(Width != null && Height != null ? $"{Width}x{Height}" : "0x0")})"; | private string DebuggerDisplay => $"{Url} ({(Width != null && Height != null ? $"{Width}x{Height}" : "0x0")})"; | ||||
public override string ToString() => Url.ToString(); | |||||
/// <summary> | |||||
/// Gets the URL of the video. | |||||
/// </summary> | |||||
public override string ToString() => Url; | |||||
} | } | ||||
} | } |
@@ -1,22 +1,38 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Represents a Discord attachment. </summary> | |||||
/// <summary> | |||||
/// Represents a Discord attachment. | |||||
/// </summary> | |||||
public interface IAttachment | public interface IAttachment | ||||
{ | { | ||||
/// <summary> Gets the snowflake ID of the attachment. </summary> | |||||
/// <summary> | |||||
/// Gets the snowflake ID of the attachment. | |||||
/// </summary> | |||||
ulong Id { get; } | ulong Id { get; } | ||||
/// <summary> Gets the filename of the attachment. </summary> | |||||
/// <summary> | |||||
/// Gets the filename of the attachment. | |||||
/// </summary> | |||||
string Filename { get; } | string Filename { get; } | ||||
/// <summary> Gets the URL of the attachment. </summary> | |||||
/// <summary> | |||||
/// Gets the URL of the attachment. | |||||
/// </summary> | |||||
string Url { get; } | string Url { get; } | ||||
/// <summary> Gets the proxied URL of the attachment. </summary> | |||||
/// <summary> | |||||
/// Gets the proxied URL of the attachment. | |||||
/// </summary> | |||||
string ProxyUrl { get; } | string ProxyUrl { get; } | ||||
/// <summary> Gets the file size of the attachment. </summary> | |||||
/// <summary> | |||||
/// Gets the file size of the attachment. | |||||
/// </summary> | |||||
int Size { get; } | int Size { get; } | ||||
/// <summary> Gets the height of the attachment if it is an image, or return <see langword="null"/> when it is not. </summary> | |||||
/// <summary> | |||||
/// Gets the height of the attachment if it is an image, or return <see langword="null" /> when it is not. | |||||
/// </summary> | |||||
int? Height { get; } | int? Height { get; } | ||||
/// <summary> Gets the width of the attachment if it is an image, or return <see langword="null"/> when it is not. </summary> | |||||
/// <summary> | |||||
/// Gets the width of the attachment if it is an image, or return <see langword="null" /> when it is not. | |||||
/// </summary> | |||||
int? Width { get; } | int? Width { get; } | ||||
} | } | ||||
} | } |
@@ -3,34 +3,62 @@ using System.Collections.Immutable; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Represents a Discord embed object. </summary> | |||||
/// <summary> | |||||
/// Represents a Discord embed object. | |||||
/// </summary> | |||||
public interface IEmbed | public interface IEmbed | ||||
{ | { | ||||
/// <summary> Gets the title URL of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the title URL of the embed. | |||||
/// </summary> | |||||
string Url { get; } | string Url { get; } | ||||
/// <summary> Gets the title of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the title of the embed. | |||||
/// </summary> | |||||
string Title { get; } | string Title { get; } | ||||
/// <summary> Gets the description of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the description of the embed. | |||||
/// </summary> | |||||
string Description { get; } | string Description { get; } | ||||
/// <summary> Gets the type of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the type of the embed. | |||||
/// </summary> | |||||
EmbedType Type { get; } | EmbedType Type { get; } | ||||
/// <summary> Gets the timestamp of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the timestamp of the embed, or <see langword="null" /> if none is set. | |||||
/// </summary> | |||||
DateTimeOffset? Timestamp { get; } | DateTimeOffset? Timestamp { get; } | ||||
/// <summary> Gets the sidebar color of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the sidebar color of the embed, or <see langword="null" /> if none is set. | |||||
/// </summary> | |||||
Color? Color { get; } | Color? Color { get; } | ||||
/// <summary> Gets the image of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the image of the embed, or <see langword="null" /> if none is set. | |||||
/// </summary> | |||||
EmbedImage? Image { get; } | EmbedImage? Image { get; } | ||||
/// <summary> Gets the video of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the video of the embed, or <see langword="null" /> if none is set. | |||||
/// </summary> | |||||
EmbedVideo? Video { get; } | EmbedVideo? Video { get; } | ||||
/// <summary> Gets the author field of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the author field of the embed, or <see langword="null" /> if none is set. | |||||
/// </summary> | |||||
EmbedAuthor? Author { get; } | EmbedAuthor? Author { get; } | ||||
/// <summary> Gets the footer field of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the footer field of the embed, or <see langword="null" /> if none is set. | |||||
/// </summary> | |||||
EmbedFooter? Footer { get; } | EmbedFooter? Footer { get; } | ||||
/// <summary> Gets the provider of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the provider of the embed, or <see langword="null" /> if none is set. | |||||
/// </summary> | |||||
EmbedProvider? Provider { get; } | EmbedProvider? Provider { get; } | ||||
/// <summary> Gets the thumbnail featured in the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the thumbnail featured in the embed, or <see langword="null" /> if none is set. | |||||
/// </summary> | |||||
EmbedThumbnail? Thumbnail { get; } | EmbedThumbnail? Thumbnail { get; } | ||||
/// <summary> Gets the fields of the embed. </summary> | |||||
/// <summary> | |||||
/// Gets the fields of the embed. | |||||
/// </summary> | |||||
ImmutableArray<EmbedField> Fields { get; } | ImmutableArray<EmbedField> Fields { get; } | ||||
} | } | ||||
} | } |
@@ -3,40 +3,72 @@ using System.Collections.Generic; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Represents a Discord message object. </summary> | |||||
/// <summary> | |||||
/// Represents a Discord message object. | |||||
/// </summary> | |||||
public interface IMessage : ISnowflakeEntity, IDeletable | public interface IMessage : ISnowflakeEntity, IDeletable | ||||
{ | { | ||||
/// <summary> Gets the type of this system message. </summary> | |||||
/// <summary> | |||||
/// Gets the type of this system message. | |||||
/// </summary> | |||||
MessageType Type { get; } | MessageType Type { get; } | ||||
/// <summary> Gets the source of this message. </summary> | |||||
/// <summary> | |||||
/// Gets the source type of this message. | |||||
/// </summary> | |||||
MessageSource Source { get; } | MessageSource Source { get; } | ||||
/// <summary> Returns true if this message was sent as a text-to-speech message. </summary> | |||||
/// <summary> | |||||
/// Returns <see langword="true"/> if this message was sent as a text-to-speech message. | |||||
/// </summary> | |||||
bool IsTTS { get; } | bool IsTTS { get; } | ||||
/// <summary> Returns true if this message was added to its channel's pinned messages. </summary> | |||||
/// <summary> | |||||
/// Returns <see langword="true"/> if this message was added to its channel's pinned messages. | |||||
/// </summary> | |||||
bool IsPinned { get; } | bool IsPinned { get; } | ||||
/// <summary> Returns the content for this message. </summary> | |||||
/// <summary> | |||||
/// Returns the content for this message. | |||||
/// </summary> | |||||
string Content { get; } | string Content { get; } | ||||
/// <summary> Gets the time this message was sent. </summary> | |||||
/// <summary> | |||||
/// Gets the time this message was sent. | |||||
/// </summary> | |||||
DateTimeOffset Timestamp { get; } | DateTimeOffset Timestamp { get; } | ||||
/// <summary> Gets the time of this message's last edit, if any. </summary> | |||||
/// <summary> | |||||
/// Gets the time of this message's last edit, or <see langword="null" /> if none is set. | |||||
/// </summary> | |||||
DateTimeOffset? EditedTimestamp { get; } | DateTimeOffset? EditedTimestamp { get; } | ||||
/// <summary> Gets the channel this message was sent to. </summary> | |||||
/// <summary> | |||||
/// Gets the channel this message was sent to. | |||||
/// </summary> | |||||
IMessageChannel Channel { get; } | IMessageChannel Channel { get; } | ||||
/// <summary> Gets the author of this message. </summary> | |||||
/// <summary> | |||||
/// Gets the author of this message. | |||||
/// </summary> | |||||
IUser Author { get; } | IUser Author { get; } | ||||
/// <summary> Returns all attachments included in this message. </summary> | |||||
/// <summary> | |||||
/// Returns all attachments included in this message. | |||||
/// </summary> | |||||
IReadOnlyCollection<IAttachment> Attachments { get; } | IReadOnlyCollection<IAttachment> Attachments { get; } | ||||
/// <summary> Returns all embeds included in this message. </summary> | |||||
/// <summary> | |||||
/// Returns all embeds included in this message. | |||||
/// </summary> | |||||
IReadOnlyCollection<IEmbed> Embeds { get; } | IReadOnlyCollection<IEmbed> Embeds { get; } | ||||
/// <summary> Returns all tags included in this message's content. </summary> | |||||
/// <summary> | |||||
/// Returns all tags included in this message's content. | |||||
/// </summary> | |||||
IReadOnlyCollection<ITag> Tags { get; } | IReadOnlyCollection<ITag> Tags { get; } | ||||
/// <summary> Returns the ids of channels mentioned in this message. </summary> | |||||
/// <summary> | |||||
/// Returns the IDs of channels mentioned in this message. | |||||
/// </summary> | |||||
IReadOnlyCollection<ulong> MentionedChannelIds { get; } | IReadOnlyCollection<ulong> MentionedChannelIds { get; } | ||||
/// <summary> Returns the ids of roles mentioned in this message. </summary> | |||||
/// <summary> | |||||
/// Returns the IDs of roles mentioned in this message. | |||||
/// </summary> | |||||
IReadOnlyCollection<ulong> MentionedRoleIds { get; } | IReadOnlyCollection<ulong> MentionedRoleIds { get; } | ||||
/// <summary> Returns the ids of users mentioned in this message. </summary> | |||||
/// <summary> | |||||
/// Returns the IDs of users mentioned in this message. | |||||
/// </summary> | |||||
IReadOnlyCollection<ulong> MentionedUserIds { get; } | IReadOnlyCollection<ulong> MentionedUserIds { get; } | ||||
} | } | ||||
} | } |
@@ -1,9 +1,13 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Represents a Discord reaction object. </summary> | |||||
/// <summary> | |||||
/// Represents a generic reaction object. | |||||
/// </summary> | |||||
public interface IReaction | public interface IReaction | ||||
{ | { | ||||
/// <summary> The <see cref="IEmote"/> used in the reaction. </summary> | |||||
/// <summary> | |||||
/// The <see cref="IEmote" /> used in the reaction. | |||||
/// </summary> | |||||
IEmote Emote { get; } | IEmote Emote { get; } | ||||
} | } | ||||
} | } |
@@ -1,6 +1,8 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Represents a message sent by the system. </summary> | |||||
/// <summary> | |||||
/// Represents a message sent by the system. | |||||
/// </summary> | |||||
public interface ISystemMessage : IMessage | public interface ISystemMessage : IMessage | ||||
{ | { | ||||
} | } | ||||
@@ -4,29 +4,49 @@ using System.Threading.Tasks; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Represents a Discord message object. </summary> | |||||
/// <summary> | |||||
/// Represents a Discord message object. | |||||
/// </summary> | |||||
public interface IUserMessage : IMessage | public interface IUserMessage : IMessage | ||||
{ | { | ||||
/// <summary> Modifies this message. </summary> | |||||
/// <summary> | |||||
/// Modifies this message. | |||||
/// </summary> | |||||
Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null); | Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null); | ||||
/// <summary> Adds this message to its channel's pinned messages. </summary> | |||||
/// <summary> | |||||
/// Adds this message to its channel's pinned messages. | |||||
/// </summary> | |||||
Task PinAsync(RequestOptions options = null); | Task PinAsync(RequestOptions options = null); | ||||
/// <summary> Removes this message from its channel's pinned messages. </summary> | |||||
/// <summary> | |||||
/// Removes this message from its channel's pinned messages. | |||||
/// </summary> | |||||
Task UnpinAsync(RequestOptions options = null); | Task UnpinAsync(RequestOptions options = null); | ||||
/// <summary> Returns all reactions included in this message. </summary> | |||||
/// <summary> | |||||
/// Returns all reactions included in this message. | |||||
/// </summary> | |||||
IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions { get; } | IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions { get; } | ||||
/// <summary> Adds a reaction to this message. </summary> | |||||
/// <summary> | |||||
/// Adds a reaction to this message. | |||||
/// </summary> | |||||
Task AddReactionAsync(IEmote emote, RequestOptions options = null); | Task AddReactionAsync(IEmote emote, RequestOptions options = null); | ||||
/// <summary> Removes a reaction from message. </summary> | |||||
/// <summary> | |||||
/// Removes a reaction from message. | |||||
/// </summary> | |||||
Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null); | Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null); | ||||
/// <summary> Removes all reactions from this message. </summary> | |||||
/// <summary> | |||||
/// Removes all reactions from this message. | |||||
/// </summary> | |||||
Task RemoveAllReactionsAsync(RequestOptions options = null); | Task RemoveAllReactionsAsync(RequestOptions options = null); | ||||
/// <summary> Gets all users that reacted to a message with a given emote. </summary> | |||||
/// <summary> | |||||
/// Gets all users that reacted to a message with a given emote. | |||||
/// </summary> | |||||
Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emoji, int limit = 100, ulong? afterUserId = null, RequestOptions options = null); | Task<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emoji, int limit = 100, ulong? afterUserId = null, RequestOptions options = null); | ||||
/// <summary> Transforms this message's text into a human-readable form by resolving its tags. </summary> | |||||
/// <summary> | |||||
/// Transforms this message's text into a human-readable form by resolving its tags. | |||||
/// </summary> | |||||
string Resolve( | string Resolve( | ||||
TagHandling userHandling = TagHandling.Name, | TagHandling userHandling = TagHandling.Name, | ||||
TagHandling channelHandling = TagHandling.Name, | TagHandling channelHandling = TagHandling.Name, | ||||
@@ -1,36 +1,36 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Properties that are used to modify an <see cref="IUserMessage"/> with the specified changes. | |||||
/// Properties that are used to modify an <see cref="IUserMessage" /> with the specified changes. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// The content of a message can be cleared with String.Empty; if and only if an Embed is present. | |||||
/// The content of a message can be cleared with String.Empty; if and only if an Embed is present. | |||||
/// </remarks> | /// </remarks> | ||||
/// <example> | /// <example> | ||||
/// <code language="c#"> | |||||
/// var message = await ReplyAsync("abc"); | |||||
/// await message.ModifyAsync(x => | |||||
/// { | |||||
/// x.Content = ""; | |||||
/// x.Embed = new EmbedBuilder() | |||||
/// .WithColor(new Color(40, 40, 120)) | |||||
/// .WithAuthor(a => a.Name = "foxbot") | |||||
/// .WithTitle("Embed!") | |||||
/// .WithDescription("This is an embed."); | |||||
/// }); | |||||
/// </code> | |||||
/// <code lang="c#"> | |||||
/// var message = await ReplyAsync("abc"); | |||||
/// await message.ModifyAsync(x => | |||||
/// { | |||||
/// x.Content = ""; | |||||
/// x.Embed = new EmbedBuilder() | |||||
/// .WithColor(new Color(40, 40, 120)) | |||||
/// .WithAuthor(a => a.Name = "foxbot") | |||||
/// .WithTitle("Embed!") | |||||
/// .WithDescription("This is an embed."); | |||||
/// }); | |||||
/// </code> | |||||
/// </example> | /// </example> | ||||
public class MessageProperties | public class MessageProperties | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// The content of the message. | |||||
/// Gets or sets the content of the message. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// This must be less than 2000 characters. | |||||
/// This must be less than 2000 characters. | |||||
/// </remarks> | /// </remarks> | ||||
public Optional<string> Content { get; set; } | public Optional<string> Content { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// The embed the message should display. | |||||
/// Gets or sets the embed the message should display. | |||||
/// </summary> | /// </summary> | ||||
public Optional<Embed> Embed { get; set; } | public Optional<Embed> Embed { get; set; } | ||||
} | } | ||||
@@ -1,15 +1,25 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Specifies the source of the Discord message. </summary> | |||||
/// <summary> | |||||
/// Specifies the source of the Discord message. | |||||
/// </summary> | |||||
public enum MessageSource | public enum MessageSource | ||||
{ | { | ||||
/// <summary> The message is sent by the system. </summary> | |||||
/// <summary> | |||||
/// The message is sent by the system. | |||||
/// </summary> | |||||
System, | System, | ||||
/// <summary> The message is sent by a user. </summary> | |||||
/// <summary> | |||||
/// The message is sent by a user. | |||||
/// </summary> | |||||
User, | User, | ||||
/// <summary> The message is sent by a bot. </summary> | |||||
/// <summary> | |||||
/// The message is sent by a bot. | |||||
/// </summary> | |||||
Bot, | Bot, | ||||
/// <summary> The message is sent by a webhook. </summary> | |||||
/// <summary> | |||||
/// The message is sent by a webhook. | |||||
/// </summary> | |||||
Webhook | Webhook | ||||
} | } | ||||
} | } |
@@ -1,21 +1,37 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> Specifies the type of message. </summary> | |||||
/// <summary> | |||||
/// Specifies the type of message. | |||||
/// </summary> | |||||
public enum MessageType | public enum MessageType | ||||
{ | { | ||||
/// <summary> The default message type. </summary> | |||||
/// <summary> | |||||
/// The default message type. | |||||
/// </summary> | |||||
Default = 0, | Default = 0, | ||||
/// <summary> The message when a recipient is added. </summary> | |||||
/// <summary> | |||||
/// The message when a recipient is added. | |||||
/// </summary> | |||||
RecipientAdd = 1, | RecipientAdd = 1, | ||||
/// <summary> The message when a recipient is removed. </summary> | |||||
/// <summary> | |||||
/// The message when a recipient is removed. | |||||
/// </summary> | |||||
RecipientRemove = 2, | RecipientRemove = 2, | ||||
/// <summary> The message when a user is called. </summary> | |||||
/// <summary> | |||||
/// The message when a user is called. | |||||
/// </summary> | |||||
Call = 3, | Call = 3, | ||||
/// <summary> The message when a channel name is changed. </summary> | |||||
/// <summary> | |||||
/// The message when a channel name is changed. | |||||
/// </summary> | |||||
ChannelNameChange = 4, | ChannelNameChange = 4, | ||||
/// <summary> The message when a channel icon is changed. </summary> | |||||
/// <summary> | |||||
/// The message when a channel icon is changed. | |||||
/// </summary> | |||||
ChannelIconChange = 5, | ChannelIconChange = 5, | ||||
/// <summary> The message when another message is pinned. </summary> | |||||
/// <summary> | |||||
/// The message when another message is pinned. | |||||
/// </summary> | |||||
ChannelPinnedMessage = 6 | ChannelPinnedMessage = 6 | ||||
} | } | ||||
} | } |
@@ -1,12 +1,18 @@ | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> A metadata containing reaction information. </summary> | |||||
/// <summary> | |||||
/// A metadata containing reaction information. | |||||
/// </summary> | |||||
public struct ReactionMetadata | public struct ReactionMetadata | ||||
{ | { | ||||
/// <summary> Gets the number of reactions. </summary> | |||||
/// <summary> | |||||
/// Gets the number of reactions. | |||||
/// </summary> | |||||
public int ReactionCount { get; internal set; } | public int ReactionCount { get; internal set; } | ||||
/// <summary> Returns true if the current user has used this reaction. </summary> | |||||
/// <summary> | |||||
/// Returns <see langword="true"/> if the current user has used this reaction. | |||||
/// </summary> | |||||
public bool IsMe { get; internal set; } | public bool IsMe { get; internal set; } | ||||
} | } | ||||
} | } |
@@ -17,21 +17,21 @@ namespace Discord | |||||
public class GuildUserProperties | public class GuildUserProperties | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Sets whether the user should be muted in a voice channel. | |||||
/// Gets or sets whether the user should be muted in a voice channel. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// If this value is set to <see langword="true"/>, no user will be able to hear this user speak in the guild. | /// If this value is set to <see langword="true"/>, no user will be able to hear this user speak in the guild. | ||||
/// </remarks> | /// </remarks> | ||||
public Optional<bool> Mute { get; set; } | public Optional<bool> Mute { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// Sets whether the user should be deafened in a voice channel. | |||||
/// Gets or sets whether the user should be deafened in a voice channel. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// If this value is set to <see langword="true"/>, this user will not be able to hear anyone speak in the guild. | /// If this value is set to <see langword="true"/>, this user will not be able to hear anyone speak in the guild. | ||||
/// </remarks> | /// </remarks> | ||||
public Optional<bool> Deaf { get; set; } | public Optional<bool> Deaf { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// Sets the user's nickname. | |||||
/// Gets or sets the user's nickname. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// To clear the user's nickname, this value can be set to <see langword="null" /> or | /// To clear the user's nickname, this value can be set to <see langword="null" /> or | ||||
@@ -39,7 +39,7 @@ namespace Discord | |||||
/// </remarks> | /// </remarks> | ||||
public Optional<string> Nickname { get; set; } | public Optional<string> Nickname { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// Sets the roles the user should have. | |||||
/// Gets or sets the roles the user should have. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// <para> | /// <para> | ||||
@@ -53,7 +53,7 @@ namespace Discord | |||||
/// </remarks> | /// </remarks> | ||||
public Optional<IEnumerable<IRole>> Roles { get; set; } | public Optional<IEnumerable<IRole>> Roles { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// Sets the roles the user should have. | |||||
/// Gets or sets the roles the user should have. | |||||
/// </summary> | /// </summary> | ||||
/// <remarks> | /// <remarks> | ||||
/// <para> | /// <para> | ||||
@@ -15,11 +15,11 @@ namespace Discord | |||||
public class SelfUserProperties | public class SelfUserProperties | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Sets the username. | |||||
/// Gets or sets the username. | |||||
/// </summary> | /// </summary> | ||||
public Optional<string> Username { get; set; } | public Optional<string> Username { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// Sets the avatar. | |||||
/// Gets or sets the avatar. | |||||
/// </summary> | /// </summary> | ||||
public Optional<Image?> Avatar { get; set; } | public Optional<Image?> Avatar { get; set; } | ||||
} | } | ||||
@@ -4,7 +4,7 @@ namespace Discord | |||||
public static class Format | public static class Format | ||||
{ | { | ||||
// Characters which need escaping | // Characters which need escaping | ||||
private static string[] SensitiveCharacters = { "\\", "*", "_", "~", "`" }; | |||||
private static readonly string[] SensitiveCharacters = { "\\", "*", "_", "~", "`" }; | |||||
/// <summary> Returns a markdown-formatted string with bold formatting. </summary> | /// <summary> Returns a markdown-formatted string with bold formatting. </summary> | ||||
public static string Bold(string text) => $"**{text}**"; | public static string Bold(string text) => $"**{text}**"; | ||||
@@ -2,6 +2,9 @@ using System.Threading; | |||||
namespace Discord | namespace Discord | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents options that should be used when sending a request. | |||||
/// </summary> | |||||
public class RequestOptions | public class RequestOptions | ||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
@@ -7,8 +7,17 @@ namespace Discord | |||||
{ | { | ||||
[Obsolete("User logins are deprecated and may result in a ToS strike against your account - please see https://github.com/RogueException/Discord.Net/issues/827", error: true)] | [Obsolete("User logins are deprecated and may result in a ToS strike against your account - please see https://github.com/RogueException/Discord.Net/issues/827", error: true)] | ||||
User, | User, | ||||
/// <summary> | |||||
/// An OAuth2 token type. | |||||
/// </summary> | |||||
Bearer, | Bearer, | ||||
/// <summary> | |||||
/// A bot token type. | |||||
/// </summary> | |||||
Bot, | Bot, | ||||
/// <summary> | |||||
/// A webhook token type. | |||||
/// </summary> | |||||
Webhook | Webhook | ||||
} | } | ||||
} | } |
@@ -4,26 +4,45 @@ using System.Threading.Tasks; | |||||
namespace Discord.Rest | namespace Discord.Rest | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a REST channel that can send and receive messages. | |||||
/// </summary> | |||||
public interface IRestMessageChannel : IMessageChannel | public interface IRestMessageChannel : IMessageChannel | ||||
{ | { | ||||
/// <summary> Sends a message to this message channel. </summary> | |||||
/// <summary> | |||||
/// Sends a message to this message channel. | |||||
/// </summary> | |||||
new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary> | |||||
/// <summary> | |||||
/// Sends a file to this message channel, with an optional caption. | |||||
/// </summary> | |||||
new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendFileAsync(string filePath, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
#endif | #endif | ||||
/// <summary> Sends a file to this text channel, with an optional caption. </summary> | |||||
/// <summary> | |||||
/// Sends a file to this message channel, with an optional caption. | |||||
/// </summary> | |||||
new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | new Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null); | ||||
/// <summary> Gets a message from this message channel with the given id, or null if not found. </summary> | |||||
/// <summary> | |||||
/// Gets a message from this message channel with the given ID, or <see langword="null"/> if not found. | |||||
/// </summary> | |||||
Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null); | Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null); | ||||
/// <summary> Gets the last N messages from this message channel. </summary> | |||||
/// <summary> | |||||
/// Gets the last N messages from this message channel. | |||||
/// </summary> | |||||
IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null); | IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null); | ||||
/// <summary> Gets a collection of messages in this channel. </summary> | |||||
/// <summary> | |||||
/// Gets a collection of messages in this channel. | |||||
/// </summary> | |||||
IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null); | IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null); | ||||
/// <summary> Gets a collection of messages in this channel. </summary> | |||||
/// <summary> | |||||
/// Gets a collection of messages in this channel. | |||||
/// </summary> | |||||
IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null); | IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null); | ||||
/// <summary> Gets a collection of pinned messages in this channel. </summary> | |||||
/// <summary> | |||||
/// Gets a collection of pinned messages in this channel. | |||||
/// </summary> | |||||
new Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null); | new Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null); | ||||
} | } | ||||
} | } |
@@ -1,9 +1,15 @@ | |||||
using System.Collections.Generic; | |||||
using System.Collections.Generic; | |||||
namespace Discord.Rest | namespace Discord.Rest | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a REST channel that is private to select recipients. | |||||
/// </summary> | |||||
public interface IRestPrivateChannel : IPrivateChannel | public interface IRestPrivateChannel : IPrivateChannel | ||||
{ | { | ||||
/// <summary> | |||||
/// Users that can access this channel. | |||||
/// </summary> | |||||
new IReadOnlyCollection<RestUser> Recipients { get; } | new IReadOnlyCollection<RestUser> Recipients { get; } | ||||
} | } | ||||
} | } |
@@ -1,13 +1,14 @@ | |||||
using System; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
using System.IO; | |||||
using System.Linq; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using Model = Discord.API.Channel; | using Model = Discord.API.Channel; | ||||
namespace Discord.Rest | namespace Discord.Rest | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a REST category channel. | |||||
/// </summary> | |||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class RestCategoryChannel : RestGuildChannel, ICategoryChannel | public class RestCategoryChannel : RestGuildChannel, ICategoryChannel | ||||
{ | { | ||||
@@ -9,11 +9,14 @@ using Model = Discord.API.Channel; | |||||
namespace Discord.Rest | namespace Discord.Rest | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a REST DM channel. | |||||
/// </summary> | |||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class RestDMChannel : RestChannel, IDMChannel, IRestPrivateChannel, IRestMessageChannel, IUpdateable | |||||
public class RestDMChannel : RestChannel, IDMChannel, IRestPrivateChannel, IRestMessageChannel | |||||
{ | { | ||||
public RestUser CurrentUser { get; private set; } | |||||
public RestUser Recipient { get; private set; } | |||||
public RestUser CurrentUser { get; } | |||||
public RestUser Recipient { get; } | |||||
public IReadOnlyCollection<RestUser> Users => ImmutableArray.Create(CurrentUser, Recipient); | public IReadOnlyCollection<RestUser> Users => ImmutableArray.Create(CurrentUser, Recipient); | ||||
@@ -39,6 +42,7 @@ namespace Discord.Rest | |||||
var model = await Discord.ApiClient.GetChannelAsync(Id, options).ConfigureAwait(false); | var model = await Discord.ApiClient.GetChannelAsync(Id, options).ConfigureAwait(false); | ||||
Update(model); | Update(model); | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public Task CloseAsync(RequestOptions options = null) | public Task CloseAsync(RequestOptions options = null) | ||||
=> ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
@@ -52,26 +56,35 @@ namespace Discord.Rest | |||||
return null; | return null; | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null) | public Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null) | ||||
=> ChannelHelper.GetMessageAsync(this, Discord, id, options); | => ChannelHelper.GetMessageAsync(this, Discord, id, options); | ||||
/// <inheritdoc /> | |||||
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | ||||
=> ChannelHelper.GetMessagesAsync(this, Discord, null, Direction.Before, limit, options); | => ChannelHelper.GetMessagesAsync(this, Discord, null, Direction.Before, limit, options); | ||||
/// <inheritdoc /> | |||||
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | ||||
=> ChannelHelper.GetMessagesAsync(this, Discord, fromMessageId, dir, limit, options); | => ChannelHelper.GetMessagesAsync(this, Discord, fromMessageId, dir, limit, options); | ||||
/// <inheritdoc /> | |||||
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | ||||
=> ChannelHelper.GetMessagesAsync(this, Discord, fromMessage.Id, dir, limit, options); | => ChannelHelper.GetMessagesAsync(this, Discord, fromMessage.Id, dir, limit, options); | ||||
/// <inheritdoc /> | |||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | ||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options); | => ChannelHelper.GetPinnedMessagesAsync(this, Discord, options); | ||||
/// <inheritdoc /> | |||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
/// <inheritdoc /> | |||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | ||||
#endif | #endif | ||||
/// <inheritdoc /> | |||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | => ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | ||||
/// <inheritdoc /> | |||||
public Task TriggerTypingAsync(RequestOptions options = null) | public Task TriggerTypingAsync(RequestOptions options = null) | ||||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | => ChannelHelper.TriggerTypingAsync(this, Discord, options); | ||||
public IDisposable EnterTypingState(RequestOptions options = null) | public IDisposable EnterTypingState(RequestOptions options = null) | ||||
@@ -11,11 +11,12 @@ using Model = Discord.API.Channel; | |||||
namespace Discord.Rest | namespace Discord.Rest | ||||
{ | { | ||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class RestGroupChannel : RestChannel, IGroupChannel, IRestPrivateChannel, IRestMessageChannel, IRestAudioChannel, IUpdateable | |||||
public class RestGroupChannel : RestChannel, IGroupChannel, IRestPrivateChannel, IRestMessageChannel, IRestAudioChannel | |||||
{ | { | ||||
private string _iconId; | private string _iconId; | ||||
private ImmutableDictionary<ulong, RestGroupUser> _users; | private ImmutableDictionary<ulong, RestGroupUser> _users; | ||||
/// <inheritdoc /> | |||||
public string Name { get; private set; } | public string Name { get; private set; } | ||||
public IReadOnlyCollection<RestGroupUser> Users => _users.ToReadOnlyCollection(); | public IReadOnlyCollection<RestGroupUser> Users => _users.ToReadOnlyCollection(); | ||||
@@ -49,12 +50,13 @@ namespace Discord.Rest | |||||
users[models[i].Id] = RestGroupUser.Create(Discord, models[i]); | users[models[i].Id] = RestGroupUser.Create(Discord, models[i]); | ||||
_users = users.ToImmutable(); | _users = users.ToImmutable(); | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public override async Task UpdateAsync(RequestOptions options = null) | public override async Task UpdateAsync(RequestOptions options = null) | ||||
{ | { | ||||
var model = await Discord.ApiClient.GetChannelAsync(Id, options).ConfigureAwait(false); | var model = await Discord.ApiClient.GetChannelAsync(Id, options).ConfigureAwait(false); | ||||
Update(model); | Update(model); | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public Task LeaveAsync(RequestOptions options = null) | public Task LeaveAsync(RequestOptions options = null) | ||||
=> ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
@@ -65,26 +67,35 @@ namespace Discord.Rest | |||||
return null; | return null; | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null) | public Task<RestMessage> GetMessageAsync(ulong id, RequestOptions options = null) | ||||
=> ChannelHelper.GetMessageAsync(this, Discord, id, options); | => ChannelHelper.GetMessageAsync(this, Discord, id, options); | ||||
/// <inheritdoc /> | |||||
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | ||||
=> ChannelHelper.GetMessagesAsync(this, Discord, null, Direction.Before, limit, options); | => ChannelHelper.GetMessagesAsync(this, Discord, null, Direction.Before, limit, options); | ||||
/// <inheritdoc /> | |||||
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | ||||
=> ChannelHelper.GetMessagesAsync(this, Discord, fromMessageId, dir, limit, options); | => ChannelHelper.GetMessagesAsync(this, Discord, fromMessageId, dir, limit, options); | ||||
/// <inheritdoc /> | |||||
public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | public IAsyncEnumerable<IReadOnlyCollection<RestMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = DiscordConfig.MaxMessagesPerBatch, RequestOptions options = null) | ||||
=> ChannelHelper.GetMessagesAsync(this, Discord, fromMessage.Id, dir, limit, options); | => ChannelHelper.GetMessagesAsync(this, Discord, fromMessage.Id, dir, limit, options); | ||||
/// <inheritdoc /> | |||||
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null) | ||||
=> ChannelHelper.GetPinnedMessagesAsync(this, Discord, options); | => ChannelHelper.GetPinnedMessagesAsync(this, Discord, options); | ||||
/// <inheritdoc /> | |||||
public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendMessageAsync(string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | => ChannelHelper.SendMessageAsync(this, Discord, text, isTTS, embed, options); | ||||
#if FILESYSTEM | #if FILESYSTEM | ||||
/// <inheritdoc /> | |||||
public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | => ChannelHelper.SendFileAsync(this, Discord, filePath, text, isTTS, embed, options); | ||||
#endif | #endif | ||||
/// <inheritdoc /> | |||||
public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null) | ||||
=> ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | => ChannelHelper.SendFileAsync(this, Discord, stream, filename, text, isTTS, embed, options); | ||||
/// <inheritdoc /> | |||||
public Task TriggerTypingAsync(RequestOptions options = null) | public Task TriggerTypingAsync(RequestOptions options = null) | ||||
=> ChannelHelper.TriggerTypingAsync(this, Discord, options); | => ChannelHelper.TriggerTypingAsync(this, Discord, options); | ||||
public IDisposable EnterTypingState(RequestOptions options = null) | public IDisposable EnterTypingState(RequestOptions options = null) | ||||
@@ -1,4 +1,4 @@ | |||||
using System; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -7,16 +7,24 @@ using Model = Discord.API.Channel; | |||||
namespace Discord.Rest | namespace Discord.Rest | ||||
{ | { | ||||
public class RestGuildChannel : RestChannel, IGuildChannel, IUpdateable | |||||
/// <summary> | |||||
/// Represents a private REST group channel. | |||||
/// </summary> | |||||
public class RestGuildChannel : RestChannel, IGuildChannel | |||||
{ | { | ||||
private ImmutableArray<Overwrite> _overwrites; | private ImmutableArray<Overwrite> _overwrites; | ||||
/// <inheritdoc /> | |||||
public IReadOnlyCollection<Overwrite> PermissionOverwrites => _overwrites; | public IReadOnlyCollection<Overwrite> PermissionOverwrites => _overwrites; | ||||
internal IGuild Guild { get; } | internal IGuild Guild { get; } | ||||
/// <inheritdoc /> | |||||
public string Name { get; private set; } | public string Name { get; private set; } | ||||
/// <inheritdoc /> | |||||
public int Position { get; private set; } | public int Position { get; private set; } | ||||
/// <inheritdoc /> | |||||
public ulong? CategoryId { get; private set; } | public ulong? CategoryId { get; private set; } | ||||
/// <inheritdoc /> | |||||
public ulong GuildId => Guild.Id; | public ulong GuildId => Guild.Id; | ||||
internal RestGuildChannel(BaseDiscordClient discord, IGuild guild, ulong id) | internal RestGuildChannel(BaseDiscordClient discord, IGuild guild, ulong id) | ||||
@@ -51,19 +59,23 @@ namespace Discord.Rest | |||||
_overwrites = newOverwrites.ToImmutable(); | _overwrites = newOverwrites.ToImmutable(); | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public override async Task UpdateAsync(RequestOptions options = null) | public override async Task UpdateAsync(RequestOptions options = null) | ||||
{ | { | ||||
var model = await Discord.ApiClient.GetChannelAsync(GuildId, Id, options).ConfigureAwait(false); | var model = await Discord.ApiClient.GetChannelAsync(GuildId, Id, options).ConfigureAwait(false); | ||||
Update(model); | Update(model); | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public async Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null) | public async Task ModifyAsync(Action<GuildChannelProperties> func, RequestOptions options = null) | ||||
{ | { | ||||
var model = await ChannelHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | var model = await ChannelHelper.ModifyAsync(this, Discord, func, options).ConfigureAwait(false); | ||||
Update(model); | Update(model); | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
=> ChannelHelper.DeleteAsync(this, Discord, options); | => ChannelHelper.DeleteAsync(this, Discord, options); | ||||
/// <inheritdoc /> | |||||
public async Task<ICategoryChannel> GetCategoryAsync() | public async Task<ICategoryChannel> GetCategoryAsync() | ||||
{ | { | ||||
if (CategoryId.HasValue) | if (CategoryId.HasValue) | ||||
@@ -1,4 +1,4 @@ | |||||
using System; | |||||
using System; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using Model = Discord.API.Invite; | using Model = Discord.API.Invite; | ||||
@@ -8,14 +8,20 @@ namespace Discord.Rest | |||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class RestInvite : RestEntity<string>, IInvite, IUpdateable | public class RestInvite : RestEntity<string>, IInvite, IUpdateable | ||||
{ | { | ||||
/// <inheritdoc /> | |||||
public string ChannelName { get; private set; } | public string ChannelName { get; private set; } | ||||
/// <inheritdoc /> | |||||
public string GuildName { get; private set; } | public string GuildName { get; private set; } | ||||
/// <inheritdoc /> | |||||
public ulong ChannelId { get; private set; } | public ulong ChannelId { get; private set; } | ||||
/// <inheritdoc /> | |||||
public ulong GuildId { get; private set; } | public ulong GuildId { get; private set; } | ||||
internal IChannel Channel { get; private set; } | |||||
internal IGuild Guild { get; private set; } | |||||
internal IChannel Channel { get; } | |||||
internal IGuild Guild { get; } | |||||
/// <inheritdoc /> | |||||
public string Code => Id; | public string Code => Id; | ||||
/// <inheritdoc /> | |||||
public string Url => $"{DiscordConfig.InviteUrl}{Code}"; | public string Url => $"{DiscordConfig.InviteUrl}{Code}"; | ||||
internal RestInvite(BaseDiscordClient discord, IGuild guild, IChannel channel, string id) | internal RestInvite(BaseDiscordClient discord, IGuild guild, IChannel channel, string id) | ||||
@@ -37,15 +43,17 @@ namespace Discord.Rest | |||||
GuildName = model.Guild.Name; | GuildName = model.Guild.Name; | ||||
ChannelName = model.Channel.Name; | ChannelName = model.Channel.Name; | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public async Task UpdateAsync(RequestOptions options = null) | public async Task UpdateAsync(RequestOptions options = null) | ||||
{ | { | ||||
var model = await Discord.ApiClient.GetInviteAsync(Code, options).ConfigureAwait(false); | var model = await Discord.ApiClient.GetInviteAsync(Code, options).ConfigureAwait(false); | ||||
Update(model); | Update(model); | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
=> InviteHelper.DeleteAsync(this, Discord, options); | => InviteHelper.DeleteAsync(this, Discord, options); | ||||
/// <inheritdoc /> | |||||
public Task AcceptAsync(RequestOptions options = null) | public Task AcceptAsync(RequestOptions options = null) | ||||
=> InviteHelper.AcceptAsync(this, Discord, options); | => InviteHelper.AcceptAsync(this, Discord, options); | ||||
@@ -1,19 +1,29 @@ | |||||
using System; | |||||
using System; | |||||
using Model = Discord.API.InviteMetadata; | using Model = Discord.API.InviteMetadata; | ||||
namespace Discord.Rest | namespace Discord.Rest | ||||
{ | { | ||||
/// <summary> Represents additional information regarding the REST invite object. </summary> | |||||
public class RestInviteMetadata : RestInvite, IInviteMetadata | public class RestInviteMetadata : RestInvite, IInviteMetadata | ||||
{ | { | ||||
private long _createdAtTicks; | private long _createdAtTicks; | ||||
/// <inheritdoc /> | |||||
public bool IsRevoked { get; private set; } | public bool IsRevoked { get; private set; } | ||||
/// <inheritdoc /> | |||||
public bool IsTemporary { get; private set; } | public bool IsTemporary { get; private set; } | ||||
/// <inheritdoc /> | |||||
public int? MaxAge { get; private set; } | public int? MaxAge { get; private set; } | ||||
/// <inheritdoc /> | |||||
public int? MaxUses { get; private set; } | public int? MaxUses { get; private set; } | ||||
/// <inheritdoc /> | |||||
public int Uses { get; private set; } | public int Uses { get; private set; } | ||||
/// <summary> | |||||
/// Gets the user that created this invite. | |||||
/// </summary> | |||||
public RestUser Inviter { get; private set; } | public RestUser Inviter { get; private set; } | ||||
/// <inheritdoc /> | |||||
public DateTimeOffset CreatedAt => DateTimeUtils.FromTicks(_createdAtTicks); | public DateTimeOffset CreatedAt => DateTimeUtils.FromTicks(_createdAtTicks); | ||||
internal RestInviteMetadata(BaseDiscordClient discord, IGuild guild, IChannel channel, string id) | internal RestInviteMetadata(BaseDiscordClient discord, IGuild guild, IChannel channel, string id) | ||||
@@ -1,4 +1,4 @@ | |||||
using System; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -11,23 +11,33 @@ namespace Discord.Rest | |||||
{ | { | ||||
private long _timestampTicks; | private long _timestampTicks; | ||||
/// <inheritdoc /> | |||||
public IMessageChannel Channel { get; } | public IMessageChannel Channel { get; } | ||||
public IUser Author { get; } | public IUser Author { get; } | ||||
/// <inheritdoc /> | |||||
public MessageSource Source { get; } | public MessageSource Source { get; } | ||||
/// <inheritdoc /> | |||||
public string Content { get; private set; } | public string Content { get; private set; } | ||||
/// <inheritdoc /> | |||||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | ||||
/// <inheritdoc /> | |||||
public virtual bool IsTTS => false; | public virtual bool IsTTS => false; | ||||
/// <inheritdoc /> | |||||
public virtual bool IsPinned => false; | public virtual bool IsPinned => false; | ||||
/// <inheritdoc /> | |||||
public virtual DateTimeOffset? EditedTimestamp => null; | public virtual DateTimeOffset? EditedTimestamp => null; | ||||
public virtual IReadOnlyCollection<Attachment> Attachments => ImmutableArray.Create<Attachment>(); | public virtual IReadOnlyCollection<Attachment> Attachments => ImmutableArray.Create<Attachment>(); | ||||
public virtual IReadOnlyCollection<Embed> Embeds => ImmutableArray.Create<Embed>(); | public virtual IReadOnlyCollection<Embed> Embeds => ImmutableArray.Create<Embed>(); | ||||
/// <inheritdoc /> | |||||
public virtual IReadOnlyCollection<ulong> MentionedChannelIds => ImmutableArray.Create<ulong>(); | public virtual IReadOnlyCollection<ulong> MentionedChannelIds => ImmutableArray.Create<ulong>(); | ||||
/// <inheritdoc /> | |||||
public virtual IReadOnlyCollection<ulong> MentionedRoleIds => ImmutableArray.Create<ulong>(); | public virtual IReadOnlyCollection<ulong> MentionedRoleIds => ImmutableArray.Create<ulong>(); | ||||
public virtual IReadOnlyCollection<RestUser> MentionedUsers => ImmutableArray.Create<RestUser>(); | public virtual IReadOnlyCollection<RestUser> MentionedUsers => ImmutableArray.Create<RestUser>(); | ||||
public virtual IReadOnlyCollection<ITag> Tags => ImmutableArray.Create<ITag>(); | public virtual IReadOnlyCollection<ITag> Tags => ImmutableArray.Create<ITag>(); | ||||
/// <inheritdoc /> | |||||
public DateTimeOffset Timestamp => DateTimeUtils.FromTicks(_timestampTicks); | public DateTimeOffset Timestamp => DateTimeUtils.FromTicks(_timestampTicks); | ||||
internal RestMessage(BaseDiscordClient discord, ulong id, IMessageChannel channel, IUser author, MessageSource source) | internal RestMessage(BaseDiscordClient discord, ulong id, IMessageChannel channel, IUser author, MessageSource source) | ||||
@@ -53,11 +63,13 @@ namespace Discord.Rest | |||||
Content = model.Content.Value; | Content = model.Content.Value; | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public async Task UpdateAsync(RequestOptions options = null) | public async Task UpdateAsync(RequestOptions options = null) | ||||
{ | { | ||||
var model = await Discord.ApiClient.GetChannelMessageAsync(Channel.Id, Id, options).ConfigureAwait(false); | var model = await Discord.ApiClient.GetChannelMessageAsync(Channel.Id, Id, options).ConfigureAwait(false); | ||||
Update(model); | Update(model); | ||||
} | } | ||||
/// <inheritdoc /> | |||||
public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
=> MessageHelper.DeleteAsync(this, Discord, options); | => MessageHelper.DeleteAsync(this, Discord, options); | ||||
@@ -1,11 +1,21 @@ | |||||
using Model = Discord.API.Reaction; | |||||
using Model = Discord.API.Reaction; | |||||
namespace Discord.Rest | namespace Discord.Rest | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a REST reaction object. | |||||
/// </summary> | |||||
public class RestReaction : IReaction | public class RestReaction : IReaction | ||||
{ | { | ||||
/// <inheritdoc /> | |||||
public IEmote Emote { get; } | public IEmote Emote { get; } | ||||
/// <summary> | |||||
/// Gets the number of reactions added. | |||||
/// </summary> | |||||
public int Count { get; } | public int Count { get; } | ||||
/// <summary> | |||||
/// Gets whether the reactions is added by the user. | |||||
/// </summary> | |||||
public bool Me { get; } | public bool Me { get; } | ||||
internal RestReaction(IEmote emote, int count, bool me) | internal RestReaction(IEmote emote, int count, bool me) | ||||
@@ -1,23 +1,32 @@ | |||||
using System; | |||||
using System; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using Model = Discord.API.Application; | using Model = Discord.API.Application; | ||||
namespace Discord.Rest | namespace Discord.Rest | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a REST entity that contains information about a Discord application created via the developer portal. | |||||
/// </summary> | |||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class RestApplication : RestEntity<ulong>, IApplication | public class RestApplication : RestEntity<ulong>, IApplication | ||||
{ | { | ||||
protected string _iconId; | protected string _iconId; | ||||
/// <inheritdoc /> | |||||
public string Name { get; private set; } | public string Name { get; private set; } | ||||
/// <inheritdoc /> | |||||
public string Description { get; private set; } | public string Description { get; private set; } | ||||
/// <inheritdoc /> | |||||
public string[] RPCOrigins { get; private set; } | public string[] RPCOrigins { get; private set; } | ||||
public ulong Flags { get; private set; } | public ulong Flags { get; private set; } | ||||
/// <inheritdoc /> | |||||
public IUser Owner { get; private set; } | public IUser Owner { get; private set; } | ||||
/// <inheritdoc /> | |||||
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | ||||
/// <inheritdoc /> | |||||
public string IconUrl => CDN.GetApplicationIconUrl(Id, _iconId); | public string IconUrl => CDN.GetApplicationIconUrl(Id, _iconId); | ||||
internal RestApplication(BaseDiscordClient discord, ulong id) | internal RestApplication(BaseDiscordClient discord, ulong id) | ||||
@@ -14,6 +14,9 @@ using VoiceStateModel = Discord.API.VoiceState; | |||||
namespace Discord.WebSocket | namespace Discord.WebSocket | ||||
{ | { | ||||
/// <summary> | |||||
/// Represents a private WebSocket group channel. | |||||
/// </summary> | |||||
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
public class SocketGroupChannel : SocketChannel, IGroupChannel, ISocketPrivateChannel, ISocketMessageChannel, ISocketAudioChannel | public class SocketGroupChannel : SocketChannel, IGroupChannel, ISocketPrivateChannel, ISocketMessageChannel, ISocketAudioChannel | ||||
{ | { | ||||