+ ActivityType + IAttachment + ChannelPermission + ChannelPermissions + ChannelType + Attachmentpull/988/head
| @@ -1,10 +1,17 @@ | |||||
| namespace Discord | |||||
| namespace Discord | |||||
| { | { | ||||
| /// <summary> | |||||
| /// Defines user's activity type. | |||||
| /// </summary> | |||||
| public enum ActivityType | public enum ActivityType | ||||
| { | { | ||||
| /// <summary> Activity that represents a user that is playing a game. </summary> | |||||
| Playing = 0, | Playing = 0, | ||||
| /// <summary> Activity that represents a user that is streaming online. </summary> | |||||
| Streaming = 1, | Streaming = 1, | ||||
| /// <summary> Activity that represents a user that is listening to a song. </summary> | |||||
| Listening = 2, | Listening = 2, | ||||
| /// <summary> Activity that represents a user that is watching a media. </summary> | |||||
| Watching = 3 | Watching = 3 | ||||
| } | } | ||||
| } | } | ||||
| @@ -1,14 +1,21 @@ | |||||
| namespace Discord | |||||
| namespace Discord | |||||
| { | { | ||||
| public interface IAttachment | public interface IAttachment | ||||
| { | { | ||||
| /// <summary> The snowflake ID of the attachment. </summary> | |||||
| ulong Id { get; } | ulong Id { get; } | ||||
| /// <summary> The filename of the attachment. </summary> | |||||
| string Filename { get; } | string Filename { get; } | ||||
| /// <summary> The URL of the attachment. </summary> | |||||
| string Url { get; } | string Url { get; } | ||||
| /// <summary> The proxied URL of the attachment. </summary> | |||||
| string ProxyUrl { get; } | string ProxyUrl { get; } | ||||
| /// <summary> The file size of the attachment. </summary> | |||||
| int Size { get; } | int Size { get; } | ||||
| /// <summary> 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> 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; } | ||||
| } | } | ||||
| } | } | ||||
| @@ -1,4 +1,4 @@ | |||||
| using System; | |||||
| using System; | |||||
| namespace Discord | namespace Discord | ||||
| { | { | ||||
| @@ -6,33 +6,54 @@ namespace Discord | |||||
| public enum ChannelPermission : ulong | public enum ChannelPermission : ulong | ||||
| { | { | ||||
| // General | // General | ||||
| /// <summary> Allows creation of instant invites. </summary> | |||||
| CreateInstantInvite = 0x00_00_00_01, | CreateInstantInvite = 0x00_00_00_01, | ||||
| ManageChannels = 0x00_00_00_10, | |||||
| /// <summary> Allows management and editing of channels. </summary> | |||||
| ManageChannels = 0x00_00_00_10, | |||||
| // Text | // Text | ||||
| AddReactions = 0x00_00_00_40, | |||||
| /// <summary> Allows for the addition of reactions to messages. </summary> | |||||
| AddReactions = 0x00_00_00_40, | |||||
| /// <summary> Allows for reading of message. </summary> | |||||
| [Obsolete("Use ViewChannel instead.")] | [Obsolete("Use ViewChannel instead.")] | ||||
| ReadMessages = ViewChannel, | |||||
| ViewChannel = 0x00_00_04_00, | |||||
| SendMessages = 0x00_00_08_00, | |||||
| SendTTSMessages = 0x00_00_10_00, | |||||
| ManageMessages = 0x00_00_20_00, | |||||
| EmbedLinks = 0x00_00_40_00, | |||||
| AttachFiles = 0x00_00_80_00, | |||||
| ReadMessageHistory = 0x00_01_00_00, | |||||
| MentionEveryone = 0x00_02_00_00, | |||||
| UseExternalEmojis = 0x00_04_00_00, | |||||
| ReadMessages = ViewChannel, | |||||
| /// <summary> Allows guild members to view a channel, which includes reading messages in text channels. </summary> | |||||
| ViewChannel = 0x00_00_04_00, | |||||
| /// <summary> Allows for sending messages in a channel. </summary> | |||||
| SendMessages = 0x00_00_08_00, | |||||
| /// <summary> Allows for sending of text-to-speech messages. </summary> | |||||
| 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> | |||||
| EmbedLinks = 0x00_00_40_00, | |||||
| /// <summary> Allows for uploading images and files. </summary> | |||||
| AttachFiles = 0x00_00_80_00, | |||||
| /// <summary> Allows for reading of message history. </summary> | |||||
| ReadMessageHistory = 0x00_01_00_00, | |||||
| /// <summary> Allows for using the @everyone tag to notify all users in a channel, and the @here tag to notify all online users in a channel. </summary> | |||||
| MentionEveryone = 0x00_02_00_00, | |||||
| /// <summary> Allows the usage of custom emojis from other servers. </summary> | |||||
| UseExternalEmojis = 0x00_04_00_00, | |||||
| // Voice | // Voice | ||||
| Connect = 0x00_10_00_00, | |||||
| Speak = 0x00_20_00_00, | |||||
| MuteMembers = 0x00_40_00_00, | |||||
| DeafenMembers = 0x00_80_00_00, | |||||
| MoveMembers = 0x01_00_00_00, | |||||
| UseVAD = 0x02_00_00_00, | |||||
| /// <summary> Allows for joining of a voice channel. </summary> | |||||
| Connect = 0x00_10_00_00, | |||||
| /// <summary> Allows for speaking in a voice channel. </summary> | |||||
| Speak = 0x00_20_00_00, | |||||
| /// <summary> Allows for muting members in a voice channel. </summary> | |||||
| MuteMembers = 0x00_40_00_00, | |||||
| /// <summary> Allows for deafening of members in a voice channel. </summary> | |||||
| DeafenMembers = 0x00_80_00_00, | |||||
| /// <summary> Allows for moving of members between voice channels. </summary> | |||||
| MoveMembers = 0x01_00_00_00, | |||||
| /// <summary> Allows for using voice-activity-detection in a voice channel. </summary> | |||||
| UseVAD = 0x02_00_00_00, | |||||
| // More General | // More General | ||||
| ManageRoles = 0x10_00_00_00, | |||||
| ManageWebhooks = 0x20_00_00_00, | |||||
| /// <summary> Allows management and editing of roles. </summary> | |||||
| ManageRoles = 0x10_00_00_00, | |||||
| /// <summary> Allows management and editing of webhooks. </summary> | |||||
| ManageWebhooks = 0x20_00_00_00, | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,4 +1,4 @@ | |||||
| using System; | |||||
| using System; | |||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Diagnostics; | using System.Diagnostics; | ||||
| @@ -7,17 +7,17 @@ namespace Discord | |||||
| [DebuggerDisplay("{DebuggerDisplay,nq}")] | [DebuggerDisplay("{DebuggerDisplay,nq}")] | ||||
| public struct ChannelPermissions | public struct ChannelPermissions | ||||
| { | { | ||||
| /// <summary> Gets a blank ChannelPermissions that grants no permissions. </summary> | |||||
| /// <summary> Gets a blank <see cref="ChannelPermissions"/> that grants no permissions. </summary> | |||||
| public static readonly ChannelPermissions None = new ChannelPermissions(); | public static readonly ChannelPermissions None = new ChannelPermissions(); | ||||
| /// <summary> Gets a ChannelPermissions that grants all permissions for text channels. </summary> | |||||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for text channels. </summary> | |||||
| public static readonly ChannelPermissions Text = new ChannelPermissions(0b01100_0000000_1111111110001_010001); | public static readonly ChannelPermissions Text = new ChannelPermissions(0b01100_0000000_1111111110001_010001); | ||||
| /// <summary> Gets a ChannelPermissions that grants all permissions for voice channels. </summary> | |||||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for voice channels. </summary> | |||||
| public static readonly ChannelPermissions Voice = new ChannelPermissions(0b00100_1111110_0000000000000_010001); | public static readonly ChannelPermissions Voice = new ChannelPermissions(0b00100_1111110_0000000000000_010001); | ||||
| /// <summary> Gets a ChannelPermissions that grants all permissions for direct message channels. </summary> | |||||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for direct message channels. </summary> | |||||
| public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110000_000000); | public static readonly ChannelPermissions DM = new ChannelPermissions(0b00000_1000110_1011100110000_000000); | ||||
| /// <summary> Gets a ChannelPermissions that grants all permissions for group channels. </summary> | |||||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for group channels. </summary> | |||||
| public static readonly ChannelPermissions Group = new ChannelPermissions(0b00000_1000110_0001101100000_000000); | public static readonly ChannelPermissions Group = new ChannelPermissions(0b00000_1000110_0001101100000_000000); | ||||
| /// <summary> Gets a ChannelPermissions that grants all permissions for a given channelType. </summary> | |||||
| /// <summary> Gets a <see cref="ChannelPermissions"/> that grants all permissions for a given channelType. </summary> | |||||
| public static ChannelPermissions All(IChannel channel) | public static ChannelPermissions All(IChannel channel) | ||||
| { | { | ||||
| switch (channel) | switch (channel) | ||||
| @@ -30,7 +30,7 @@ namespace Discord | |||||
| } | } | ||||
| } | } | ||||
| /// <summary> Gets a packed value representing all the permissions in this ChannelPermissions. </summary> | |||||
| /// <summary> Gets a packed value representing all the permissions in this <see cref="ChannelPermissions"/>. </summary> | |||||
| public ulong RawValue { get; } | public ulong RawValue { get; } | ||||
| /// <summary> If True, a user may create invites. </summary> | /// <summary> If True, a user may create invites. </summary> | ||||
| @@ -117,7 +117,7 @@ namespace Discord | |||||
| RawValue = value; | RawValue = value; | ||||
| } | } | ||||
| /// <summary> Creates a new ChannelPermissions with the provided permissions. </summary> | |||||
| /// <summary> Creates a new <see cref="ChannelPermissions"/> with the provided permissions. </summary> | |||||
| public ChannelPermissions(bool createInstantInvite = false, bool manageChannel = false, | public ChannelPermissions(bool createInstantInvite = false, bool manageChannel = false, | ||||
| bool addReactions = false, | bool addReactions = false, | ||||
| bool viewChannel = false, bool sendMessages = false, bool sendTTSMessages = false, bool manageMessages = false, | bool viewChannel = false, bool sendMessages = false, bool sendTTSMessages = false, bool manageMessages = false, | ||||
| @@ -129,7 +129,7 @@ namespace Discord | |||||
| speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, manageRoles, manageWebhooks) | speak, muteMembers, deafenMembers, moveMembers, useVoiceActivation, manageRoles, manageWebhooks) | ||||
| { } | { } | ||||
| /// <summary> Creates a new ChannelPermissions from this one, changing the provided non-null permissions. </summary> | |||||
| /// <summary> Creates a new <see cref="ChannelPermissions"/> from this one, changing the provided non-null permissions. </summary> | |||||
| public ChannelPermissions Modify(bool? createInstantInvite = null, bool? manageChannel = null, | public ChannelPermissions Modify(bool? createInstantInvite = null, bool? manageChannel = null, | ||||
| bool? addReactions = null, | bool? addReactions = null, | ||||
| bool? viewChannel = null, bool? sendMessages = null, bool? sendTTSMessages = null, bool? manageMessages = null, | bool? viewChannel = null, bool? sendMessages = null, bool? sendTTSMessages = null, bool? manageMessages = null, | ||||
| @@ -157,4 +157,4 @@ namespace Discord | |||||
| public override string ToString() => RawValue.ToString(); | public override string ToString() => RawValue.ToString(); | ||||
| private string DebuggerDisplay => $"{string.Join(", ", ToList())}"; | private string DebuggerDisplay => $"{string.Join(", ", ToList())}"; | ||||
| } | } | ||||
| } | |||||
| } | |||||
| @@ -1,11 +1,17 @@ | |||||
| namespace Discord | |||||
| namespace Discord | |||||
| { | { | ||||
| /// <summary> Defines the types of channels. </summary> | |||||
| public enum ChannelType | public enum ChannelType | ||||
| { | { | ||||
| /// <summary> Represents a text channel. </summary> | |||||
| Text = 0, | Text = 0, | ||||
| /// <summary> Represents a Direct Message channel. </summary> | |||||
| DM = 1, | DM = 1, | ||||
| /// <summary> Represents a voice channel. </summary> | |||||
| Voice = 2, | Voice = 2, | ||||
| /// <summary> Represents a group channel. </summary> | |||||
| Group = 3, | Group = 3, | ||||
| /// <summary> Represents a category channel. </summary> | |||||
| Category = 4 | Category = 4 | ||||
| } | } | ||||
| } | } | ||||
| @@ -1,4 +1,4 @@ | |||||
| using System.Diagnostics; | |||||
| using System.Diagnostics; | |||||
| using Model = Discord.API.Attachment; | using Model = Discord.API.Attachment; | ||||
| namespace Discord | namespace Discord | ||||
| @@ -6,12 +6,19 @@ namespace Discord | |||||
| [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | ||||
| public class Attachment : IAttachment | public class Attachment : IAttachment | ||||
| { | { | ||||
| /// <inheritdoc/> | |||||
| public ulong Id { get; } | public ulong Id { get; } | ||||
| /// <inheritdoc/> | |||||
| public string Filename { get; } | public string Filename { get; } | ||||
| /// <inheritdoc/> | |||||
| public string Url { get; } | public string Url { get; } | ||||
| /// <inheritdoc/> | |||||
| public string ProxyUrl { get; } | public string ProxyUrl { get; } | ||||
| /// <inheritdoc/> | |||||
| public int Size { get; } | public int Size { get; } | ||||
| /// <inheritdoc/> | |||||
| public int? Height { get; } | public int? Height { get; } | ||||
| /// <inheritdoc/> | |||||
| public int? Width { get; } | public int? Width { get; } | ||||
| internal Attachment(ulong id, string filename, string url, string proxyUrl, int size, int? height, int? width) | internal Attachment(ulong id, string filename, string url, string proxyUrl, int size, int? height, int? width) | ||||