Skip to content

Commit

Permalink
Lots of gateway model updates~
Browse files Browse the repository at this point in the history
  • Loading branch information
Auralytical committed Jul 22, 2018
1 parent 76abc44 commit c1e567b
Show file tree
Hide file tree
Showing 34 changed files with 298 additions and 178 deletions.
14 changes: 7 additions & 7 deletions src/Wumpus.Net.Core/Entities/AuditLogs/AuditLogChangeKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public enum AuditLogChangeKey
[ModelEnumValue("$add")] AddRole,
/// <summary> <see cref="Role"/> removed. </summary>
[ModelEnumValue("$remove")] RemoveRole,
/// <summary> Change in number of days after which inactive and <see cref="Role"/>-unassigned <see cref="GuildMember"/>s are kicked. </summary>
/// <summary> Change in number of days after which inactive and <see cref="Role"/>-unassigned <see cref="User"/>s are kicked. </summary>
[ModelEnumValue("prune_delete_days")] PruneDeleteDays,
/// <summary> <see cref="Guild"/> widget enable/disable. </summary>
[ModelEnumValue("widget_enabled")] WidgetEnabled,
Expand Down Expand Up @@ -71,7 +71,7 @@ public enum AuditLogChangeKey
[ModelEnumValue("permissions")] Permissions,
/// <summary> <see cref="Role"/> color changed. </summary>
[ModelEnumValue("color")] Color,
/// <summary> <see cref="Role"/> is now displayed/no longer displayed separate from other online <see cref="GuildMember"/>s. </summary>
/// <summary> <see cref="Role"/> is now displayed/no longer displayed separate from other online <see cref="User"/>s. </summary>
[ModelEnumValue("hoist")] Hoist,
/// <summary> <see cref="Role"/> is now mentionable/unmentionable. </summary>
[ModelEnumValue("mentionable")] Mentionable,
Expand All @@ -86,7 +86,7 @@ public enum AuditLogChangeKey
[ModelEnumValue("code")] Code,
/// <summary> <see cref="Channel"/> for <see cref="Invite"/> code changed. </summary>
[ModelEnumValue("channel_id")] ChannelId,
/// <summary> <see cref="GuildMember"/> who created <see cref="Invite"/> code changed. </summary>
/// <summary> <see cref="User"/> who created <see cref="Invite"/> code changed. </summary>
[ModelEnumValue("inviter_id")] InviterId,
/// <summary> Change to the max number of times <see cref="Invite"/> code can be used. </summary>
[ModelEnumValue("max_uses")] MaxUses,
Expand All @@ -99,13 +99,13 @@ public enum AuditLogChangeKey

// User

/// <summary> <see cref="GuildMember"/> server deafened/undeafened. </summary>
/// <summary> <see cref="User"/> server deafened/undeafened. </summary>
[ModelEnumValue("deaf")] Deaf,
/// <summary> <see cref="GuildMember"/> server muted/unmuted. </summary>
/// <summary> <see cref="User"/> server muted/unmuted. </summary>
[ModelEnumValue("mute")] Mute,
/// <summary> <see cref="GuildMember"/> nickname changed. </summary>
/// <summary> <see cref="User"/> nickname changed. </summary>
[ModelEnumValue("nick")] Nick,
/// <summary> <see cref="GuildMember"/> avatar changed. </summary>
/// <summary> <see cref="User"/> avatar changed. </summary>
[ModelEnumValue("avatar_hash")] AvatarHash
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ namespace Wumpus.Entities
/// <summary> https://discordapp.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info </summary>
public class OptionalAuditEntryInfo
{
/// <summary> Number of days after which inactive <see cref="GuildMember"/>s were kicked. Action Type: <see cref="AuditLogEvent.MemberPrune"/>. </summary>
/// <summary> Number of days after which inactive <see cref="User"/>s were kicked. Action Type: <see cref="AuditLogEvent.MemberPrune"/>. </summary>
[ModelProperty("delete_member_days")]
public Optional<Utf8String> DeleteMemberDays { get; set; }
/// <summary> Number of <see cref="GuildMember"/>s removed by the prune. Action Type: <see cref="AuditLogEvent.MemberPrune"/>. </summary>
/// <summary> Number of <see cref="User"/>s removed by the prune. Action Type: <see cref="AuditLogEvent.MemberPrune"/>. </summary>
[ModelProperty("members_removed")]
public Optional<Utf8String> MembersRemoved { get; set; }
/// <summary> <see cref="Channel"/> Id in which the <see cref="Message"/>s were deleted. Action Type: <see cref="AuditLogEvent.MessageDelete"/>. </summary>
Expand All @@ -21,7 +21,7 @@ public class OptionalAuditEntryInfo
/// <summary> Id of the overwritten entity. Action Types: <see cref="AuditLogEvent.ChannelOverwriteCreate"/> &amp; <see cref="AuditLogEvent.ChannelOverwriteUpdate"/> &amp; <see cref="AuditLogEvent.ChannelOverwriteDelete"/>. </summary>
[ModelProperty("id")]
public Optional<Snowflake> Id { get; set; }
/// <summary> Type of overwritten entity. (<see cref="GuildMember"/> or <see cref="Role"/>) Action Types: <see cref="AuditLogEvent.ChannelOverwriteCreate"/> &amp; <see cref="AuditLogEvent.ChannelOverwriteUpdate"/> &amp; <see cref="AuditLogEvent.ChannelOverwriteDelete"/> </summary>
/// <summary> Type of overwritten entity. (<see cref="User"/> or <see cref="Role"/>) Action Types: <see cref="AuditLogEvent.ChannelOverwriteCreate"/> &amp; <see cref="AuditLogEvent.ChannelOverwriteUpdate"/> &amp; <see cref="AuditLogEvent.ChannelOverwriteDelete"/> </summary>
[ModelProperty("type")]
public Optional<Utf8String> Type { get; set; }
/// <summary> Name of the role if type is <see cref="Role"/>. Action Types: <see cref="AuditLogEvent.ChannelOverwriteCreate"/> &amp; <see cref="AuditLogEvent.ChannelOverwriteUpdate"/> &amp; <see cref="AuditLogEvent.ChannelOverwriteDelete"/> </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Wumpus.Net.Core/Entities/Channels/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Channel
/// <summary> Id of the parent category for a <see cref="Channel"/>. </summary>
[ModelProperty("parent_id")]
public Optional<Snowflake?> ParentId { get; set; }
/// <summary> Explicit <see cref="Overwrite"/>s for <see cref="GuildMember"/>s and <see cref="Role"/>s. </summary>
/// <summary> Explicit <see cref="Overwrite"/>s for <see cref="User"/>s and <see cref="Role"/>s. </summary>
[ModelProperty("permission_overwrites")]
public Optional<Overwrite[]> PermissionOverwrites { get; set; }
/// <summary> The name of the <see cref="Channel"/>. </summary>
Expand Down Expand Up @@ -78,7 +78,7 @@ public class Channel
/// <summary> The bitrate (in bits) of the voice <see cref="Channel"/>. </summary>
[ModelProperty("bitrate")]
public Optional<int> Bitrate { get; set; }
/// <summary> The <see cref="GuildMember"/> limit of the voice <see cref="Channel"/>. </summary>
/// <summary> The <see cref="User"/> limit of the voice <see cref="Channel"/>. </summary>
[ModelProperty("user_limit")]
public Optional<int> UserLimit { get; set; }

Expand Down
6 changes: 3 additions & 3 deletions src/Wumpus.Net.Core/Entities/Guilds/ExplicitContentFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
/// <summary> https://discordapp.com/developers/docs/resources/guild#guild-object-explicit-content-filter-level </summary>
public enum ExplicitContentFilter
{
/// <summary> <see cref="GuildMember"/>s will not have their explicit content filtered. </summary>
/// <summary> <see cref="User"/>s will not have their explicit content filtered. </summary>
Disabled = 0,
/// <summary> <see cref="GuildMember"/>s without roles will have their explicit content filtered. </summary>
/// <summary> <see cref="User"/>s without roles will have their explicit content filtered. </summary>
MembersWithoutRoles = 1,
/// <summary> All <see cref="GuildMember"/>s will have their explicit content filtered. </summary>
/// <summary> All <see cref="User"/>s will have their explicit content filtered. </summary>
AllMembers = 2
}
}
22 changes: 3 additions & 19 deletions src/Wumpus.Net.Core/Entities/Guilds/GuildMember.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
using Voltaic.Serialization;
using System;
using System;
using Voltaic;
using Voltaic.Serialization;

namespace Wumpus.Entities
{
/// <summary> https://discordapp.com/developers/docs/resources/guild#guild-embed-object </summary>
public class GuildMember
public class GuildMember : Member
{
/// <summary> <see cref="User"/> object. </summary>
[ModelProperty("user")]
public User User { get; set; }
/// <summary> This user's <see cref="Guild"/> nickname. </summary>
[ModelProperty("nick")]
public Optional<Utf8String> Nickname { get; set; }
/// <summary> Array of <see cref="Role"/> ids. </summary>
[ModelProperty("roles")]
public Optional<Snowflake[]> Roles { get; set; }
/// <summary> When the <see cref="GuildMember"/> joined the <see cref="Guild"/>. </summary>
[ModelProperty("joined_at"), StandardFormat('O')]
public Optional<DateTimeOffset> JoinedAt { get; set; }
/// <summary> If the <see cref="GuildMember"/> is deafened. </summary>
[ModelProperty("deaf")]
public Optional<bool> Deaf { get; set; }
/// <summary> If the <see cref="GuildMember"/> is muted. </summary>
[ModelProperty("mute")]
public Optional<bool> Mute { get; set; }
}
}
4 changes: 2 additions & 2 deletions src/Wumpus.Net.Core/Entities/Guilds/MfaLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
/// <summary> https://discordapp.com/developers/docs/resources/guild#guild-object-mfa-level </summary>
public enum MfaLevel
{
/// <summary> <see cref="GuildMember" />s have no additional MFA restriction on this guild. </summary>
/// <summary> <see cref="User" />s have no additional MFA restriction on this guild. </summary>
None = 0,
/// <summary> <see cref="GuildMember" />s must have MFA enabled on their account to perform administrative actions. </summary>
/// <summary> <see cref="User" />s must have MFA enabled on their account to perform administrative actions. </summary>
Elevated = 1
}
}
10 changes: 5 additions & 5 deletions src/Wumpus.Net.Core/Entities/Guilds/VerificationLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
/// <summary> https://discordapp.com/developers/docs/resources/guild#guild-object-verification-level </summary>
public enum VerificationLevel
{
/// <summary> <see cref="GuildMember"/>s have no additional restrictions on sending <see cref="Message"/>s to this <see cref="Guild"/>. </summary>
/// <summary> <see cref="User"/>s have no additional restrictions on sending <see cref="Message"/>s to this <see cref="Guild"/>. </summary>
None = 0,
/// <summary> <see cref="GuildMember"/>s must have a verified email on their account. </summary>
/// <summary> <see cref="User"/>s must have a verified email on their account. </summary>
Low = 1,
/// <summary> <see cref="GuildMember"/>s must be registered on Discord for longer than 5 minutes. </summary>
/// <summary> <see cref="User"/>s must be registered on Discord for longer than 5 minutes. </summary>
Medium = 2,
/// <summary> <see cref="GuildMember"/>s must be a member of this <see cref="Guild"/> for longer than 10 minutes. </summary>
/// <summary> <see cref="User"/>s must be a member of this <see cref="Guild"/> for longer than 10 minutes. </summary>
High = 3,
/// <summary> <see cref="GuildMember"/>s must have a verified phone on their Discord account. </summary>
/// <summary> <see cref="User"/>s must have a verified phone on their Discord account. </summary>
VeryHigh = 4
}
}
4 changes: 2 additions & 2 deletions src/Wumpus.Net.Core/Entities/Invites/Invite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public class Invite
/// <summary> The (partial) <see cref="InviteChannel"/> this <see cref="Invite"/> is for. </summary>
[ModelProperty("channel")]
public InviteChannel Channel { get; set; }
/// <summary> Approxmiate count of online <see cref="GuildMember"/>s. </summary>
/// <summary> Approxmiate count of online <see cref="User"/>s. </summary>
[ModelProperty("approximate_presence_count")]
public Optional<int> ApproximatePresenceCount { get; set; }
/// <summary> Approxmiate count of total <see cref="GuildMember"/>s. </summary>
/// <summary> Approxmiate count of total <see cref="User"/>s. </summary>
[ModelProperty("approximate_member_count")]
public Optional<int> ApproximateMemberCount { get; set; }
}
Expand Down
6 changes: 6 additions & 0 deletions src/Wumpus.Net.Core/Entities/Messages/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public class Message
/// <summary> Id of the <see cref="Message"/>. </summary>
[ModelProperty("id")]
public Snowflake Id { get; set; }
// TODO: Undocumented (https://github.com/discordapp/discord-api-docs/issues/582)
[ModelProperty("guild_id")]
public Optional<Snowflake> GuildId { get; set; }
/// <summary> Id of the <see cref="Channel"/> the <see cref="Message"/> was in. </summary>
[ModelProperty("channel_id")]
public Snowflake ChannelId { get; set; }
Expand All @@ -27,6 +30,9 @@ public class Message
/// </remarks>
[ModelProperty("author")]
public User Author { get; set; }
// TODO: Undocumented (https://github.com/discordapp/discord-api-docs/issues/582)
[ModelProperty("member")]
public Optional<Member> Member { get; set; }
/// <summary> Contents of the <see cref="Message"/>. </summary>
[ModelProperty("content")]
public Utf8String Content { get; set; }
Expand Down
52 changes: 26 additions & 26 deletions src/Wumpus.Net.Core/Entities/Permissions/ChannelPermissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,54 @@ namespace Wumpus.Entities
[Flags]
public enum ChannelPermissions : ulong
{
None = 0,
None = 0,

// General
/// <summary> Allow creation of instant <see cref="Invite"/>s. </summary>
CreateInstantInvite = 0x00000001,
/// <summary> Allows management and editing of <see cref="Channel"/>s. </summary>
ManageChannels = 0x00000010,
/// <summary> Allows <see cref="GuildMember"/>s to view a <see cref="Channel"/>, which includes reading <see cref="Message"/>s in text <see cref="Channel"/>s. </summary>
ViewChannel = 0x00000400,
/// <summary> Allows management and editing of <see cref="Role"/>s. </summary>
ManageRoles = 0x10000000,
ManageChannels = 0x00000010,
/// <summary> Allows <see cref="User"/>s to view a <see cref="Channel"/>, which includes reading <see cref="Message"/>s in text <see cref="Channel"/>s. </summary>
ViewChannel = 0x00000400,
/// <summary> Allows management and editing of <see cref="Role"/>s. </summary>
ManageRoles = 0x10000000,
/// <summary> Allows management and editing of <see cref="Webhook"/>s. </summary>
ManageWebhooks = 0x20000000,
ManageWebhooks = 0x20000000,

// Text
/// <summary> Allow for the addition of <see cref="Reaction"/>s to <see cref="Message"/>s. </summary>
AddReactions = 0x00000040,
AddReactions = 0x00000040,
/// <summary> Allows for viewing of <see cref="AuditLog"/>s. </summary>
ViewAuditLog = 0x00000080,
ViewAuditLog = 0x00000080,
/// <summary> Allows for sending <see cref="Message"/>s in a <see cref="Channel"/>. </summary>
SendMessages = 0x00000800,
SendMessages = 0x00000800,
/// <summary> Allows for sending of /tts <see cref="Message"/>s. </summary>
SendTTSMessages = 0x00001000,
SendTTSMessages = 0x00001000,
/// <summary> Allows for deletion of other <see cref="User"/>s' <see cref="Message"/>s. </summary>
ManageMessages = 0x00002000,
ManageMessages = 0x00002000,
/// <summary> Links sent by <see cref="User"/>s with this permission will be auto-embedded. </summary>
EmbedLinks = 0x00004000,
EmbedLinks = 0x00004000,
/// <summary> Allows for uploading images and files. </summary>
AttachFiles = 0x00008000,
AttachFiles = 0x00008000,
/// <summary> Allows for reading of <see cref="Message"/> history. </summary>
ReadMessageHistory = 0x00010000,
ReadMessageHistory = 0x00010000,
/// <summary> Allows for using the @everyone tag to notify all <see cref="User"/>s in a <see cref="Channel"/>, and the @here tag to notify all online <see cref="User"/>s in a <see cref="Channel"/>. </summary>
MentionEveryone = 0x00020000,
MentionEveryone = 0x00020000,
/// <summary> Allows the usage of custom <see cref="Emoji"/>s from other <see cref="Guild"/>s. </summary>
UseExternalEmojis = 0x00040000,
UseExternalEmojis = 0x00040000,

// Voice
/// <summary> Allows for joining of a voice <see cref="Channel"/>. </summary>
Connect = 0x00100000,
Connect = 0x00100000,
/// <summary> Allows for speaking in a voice <see cref="Channel"/>. </summary>
Speak = 0x00200000,
/// <summary> Allows for muting <see cref="GuildMember"/>s in a voice <see cref="Channel"/>. </summary>
MuteMembers = 0x00400000,
/// <summary> Allows for deafening of <see cref="GuildMember"/>s in a voice <see cref="Channel"/>. </summary>
DeafenMembers = 0x00800000,
/// <summary> Allows for moving of <see cref="GuildMember"/>s between voice <see cref="Channel"/>s. </summary>
MoveMembers = 0x01000000,
Speak = 0x00200000,
/// <summary> Allows for muting <see cref="User"/>s in a voice <see cref="Channel"/>. </summary>
MuteMembers = 0x00400000,
/// <summary> Allows for deafening of <see cref="User"/>s in a voice <see cref="Channel"/>. </summary>
DeafenMembers = 0x00800000,
/// <summary> Allows for moving of <see cref="User"/>s between voice <see cref="Channel"/>s. </summary>
MoveMembers = 0x01000000,
/// <summary> Allows for using voice-activity-detection in a voice <see cref="Channel"/>. </summary>
UseVAD = 0x02000000
UseVAD = 0x02000000
}
}
Loading

0 comments on commit c1e567b

Please sign in to comment.