-
-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Add INVITE_CREATE and INVITE_DELETE events #1491
Conversation
This is another version that the only similarity is the |
This isn't the first case of multiple implementations of the same feature or change. There's no such thing as "original PR". You could have used the time you used to reply to actually read the changes here and fix your own PR (and test it). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few minor questions.
@@ -367,5 +367,22 @@ public partial class BaseSocketClient | |||
remove { _recipientRemovedEvent.Remove(value); } | |||
} | |||
internal readonly AsyncEvent<Func<SocketGroupUser, Task>> _recipientRemovedEvent = new AsyncEvent<Func<SocketGroupUser, Task>>(); | |||
|
|||
//Invites | |||
/// <summary> Fired when an invite is created. </summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Still34 We've become inconsistent with how the doc comments are written. Should we start asking for one specific formatting, and if so, which one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the summary and remarks so they are more descriptive and easier to understand what's being passed like the Channel and Message events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Still34 We've become inconsistent with how the doc comments are written. Should we start asking for one specific formatting, and if so, which one?
I might be late to the party but I'm not spotting the inconsistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have <summary> Text </summary>
(one line) and
<summary>
Text
</summary>
(multiple lines, indented) both used in this PR alone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I'm leaning towards the latter. Although it takes up more space, it is easier to read when writing documentation. Perhaps we could open a new issue and or PR that addresses this in our contribution guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed all summaries to use the latter.
/// <inheritdoc /> | ||
int? IInviteMetadata.MaxAge { get => MaxAge; } | ||
/// <inheritdoc /> | ||
int? IInviteMetadata.MaxUses { get => MaxUses; } | ||
/// <inheritdoc /> | ||
int? IInviteMetadata.Uses { get => Uses; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Why are these properties explicitly implemented?
- If they really should be, why the extra braces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are required by IInviteMetadata, but shouldn't be optional for the socket entity according to the api docs so I added non-nullable ones and redirected these to them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the Invite Metadata object also has them listed as not optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason they were added as nullables.
Not sure if it was changed later by discord or it's some workaround for the lib.
Also noticed our IInvite is missing two fields that were added to INVITE_CREATE and that it doesn't match discord, there's no channel_name
or channel_type
andinviter
should be part of Invite
, not InviteMetadata
, to follow the discord object.
Might be remaining code trying to stay backward compatible, not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing again, the channel_name
and channel_type
are just what discord sends and we use the cache to get the channel, since it gets a partial channel unlike the gateway event.
I'll be adding the two event fields that are now listed in the official docs api (it was probably updated today), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit more critical about these.
Co-Authored-By: Joe4evr <jii.geugten@gmail.com>
Looks good so far. Just wanna hear back from Still about the doc comments, and (presumably fox) about what we're gonna do with those Invite Metadata fields. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks fine to me, but the small inconsistencies and the unclosed <see>
tag must be fixed before merge.
@@ -367,5 +367,22 @@ public partial class BaseSocketClient | |||
remove { _recipientRemovedEvent.Remove(value); } | |||
} | |||
internal readonly AsyncEvent<Func<SocketGroupUser, Task>> _recipientRemovedEvent = new AsyncEvent<Func<SocketGroupUser, Task>>(); | |||
|
|||
//Invites | |||
/// <summary> Fired when an invite is created. </summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Still34 We've become inconsistent with how the doc comments are written. Should we start asking for one specific formatting, and if so, which one?
I might be late to the party but I'm not spotting the inconsistency?
* fix: limit request members batch size Discord is actually enforcing v8 limits on v6 according to discord/discord-api-docs#2184 * fix: Missing AddReactions permission for DM channels. (discord-net#1244) Co-authored-by: Samuel <33796679+Samrux@users.noreply.github.com> * fix: GuildEmbed.ChannelId as nullable per API documentation (discord-net#1532) * (ifcbrk) feature: Add includeRoleIds to PruneUsersAsync (discord-net#1581) * Implemented include_roles for guilds/id/prune get&post * Unnecessary using Co-authored-by: Paulo <pnmanjos@hotmail.com> * feature: Add "View Guild Insights" to GuildPermission (discord-net#1619) * feature: Add "View Guild Insights" permission * Add missing summary Co-authored-by: Paulo <pnmanjos@hotmail.com> * fix: Audio stream dispose (discord-net#1667) * Fix audio dispose * Missed a few * feature: Add INVITE_CREATE and INVITE_DELETE events (discord-net#1491) * Add invite events (create and delete) * Removed unused using * Fixing IInviteMetadata properties * Add two new fields to the gateway event * Better event summary and remarks * Change how to assign to target variable Co-Authored-By: Joe4evr <jii.geugten@gmail.com> * Applying suggested changes to TargetUserType * Renaming NotDefined to Undefined * Fixing xml docs * Changed the summary style format Co-authored-by: Joe4evr <jii.geugten@gmail.com> * feature: Add missing application properties (including Teams) (discord-net#1604) * Add missing application properties Add IsBotPublic, BotRequiresCodeGrant, and Team properties to IApplication * To immutable list * Change list to array * feature: Add GetStreams to AudioClient (discord-net#1588) * Added GetStreams * Change return type * Change return type on the interface Co-authored-by: Paulo <pnmanjos@hotmail.com> * fix: Crosspost throwing InvalidOperationException (discord-net#1671) * Add INewsChannel * Renaming variable to match the new type * fix: Discord sends null when there's no team * fix: Team is nullable, not optional (discord-net#1672) * misc: Change ratelimit messages (discord-net#1678) * misc: Missing summary tag * fix: Emoji url encode (discord-net#1681) * feature: Add missing properties to Guild and deprecate GuildEmbed (discord-net#1573) * Add missing properties to Guild, related methods, and deprecate GuildEmbed endpoints - Add missing guild properties: `discovery_splash`, `widget_enabled`, `widget_channel_id`, `rules_channel_id`, `max_presences`, `max_presences`, `max_members`, `public_updates_channel_id`, `max_video_channel_users`, `approximate_member_count`, `approximate_presence_count` - Update guild properties: `embed_enabled`, `embed_channel_id` - Add `GetGuildDiscoverySplashUrl` to `CDN` - Add classes related to the guild widget - Add `withCounts` parameter to `GetGuild(s)Async` - Make GuildEmbed related methods obsolete with a message redirecting to widget ones * Change xml docs and PremiumSubscriptionCount type * Changed some xml docs * fix: Revert PremiumSubscriptionCount type (discord-net#1686) * feature: Implement gateway ratelimit (discord-net#1537) * Implement gateway ratelimit * Remove unused code * Share WebSocketRequestQueue between clients * Add global limit and a way to change gateway limits * Refactoring variable to fit lib standards * Update xml docs * Update xml docs * Move warning to remarks * Remove specific RequestQueue for WebSocket and other changes The only account limit is for identify that is dealt in a different way (exclusive semaphore), so websocket queues can be shared with REST and don't need to be shared between clients anymore. Also added the ratelimit for presence updates. * Add summary to IdentifySemaphoreName * Fix spacing * Add max_concurrency and other fixes - Add session_start_limit to GetBotGatewayResponse - Add GetBotGatewayAsync to IDiscordClient - Add master/slave semaphores to enable concurrency - Not store semaphore name as static - Clone GatewayLimits when cloning the Config * Add missing RequestQueue parameter and wrong nullable * Add RequeueQueue paramater to Webhook * Better xml documentation * Remove GatewayLimits class and other changes - Remove GatewayLimits - Transfer a few properties to DiscordSocketConfig - Remove unnecessary usings * Remove unnecessary using and wording * Remove more unnecessary usings * Change named Semaphores to SemaphoreSlim * Remove unused using * Update branch * Fix merge conflicts and update to new ratelimit * Fixing merge, ignore limit for heartbeat, and dispose * Missed one place and better xml docs. * Wait identify before opening the connection * Only request identify ticket when needed * Move identify control to sharded client * Better description for IdentifyMaxConcurrency * Add lock to InvalidSession * feature: Send presence on Identify payload (discord-net#1688) * Send presence on identify * Change CurrentUser presence * feature: Add inline replies (discord-net#1659) * Add inline replies * Missed a few things * Change xml docs, IUserMessage, and other changes * Missed one when changing * Fix referencedMessage author * fix: Possible NullReferenceException when receiving InvalidSession (discord-net#1695) * fix: UserMentions throwing NullRef * fix: Wrong author for SocketUserMessage.ReferencedMessage * fix: Rollback Activities to Game (discord-net#1702) * docs: Update summary of SocketVoiceChannel.Users (discord-net#1714) The inherited summary incorrectly stated that all users who _see_ the channel are returned when in reality only the ones _connected_ are. * feature: Add max bitrate value to SocketGuild * Update SocketGuild.cs * Fix returns value docs Signed-off-by: Still Hsu <dev@stillu.cc> Co-authored-by: Still Hsu <dev@stillu.cc> * fix: SocketGuild.HasAllMembers is false if a user left a guild (discord-net#1683) * Fix: HasAllMembers is false if a user left * Fix: Correct boolean logic * Add new method of role ID copy Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com> * Add missing asset Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com> * Resolve inheritdocs warning * Move bulk deletes remarks from <summary> to <remarks> * Mark null as a specific langword in summary * Cleanup GatewayReconnectException docs * Update Docfx.Plugins.LastModified to v1.2.4 Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com> * Add updated libraries for LastModified Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com> * Update project link * Add initial StyleCops style enforcement * Update framework version for tests to Core 3.1 to comply with LTS * docs: Fix MaxWaitBetweenGuildAvailablesBeforeReady docs string Signed-off-by: Still Hsu <dev@stillu.cc> * docs: Add minor tweaks to DiscordSocketConfig docs strings * docs: Fix the missing "In This Article" section * Temporarily disable StyleCops until all the fixes are impl'd * fix: Invite and InviteMetadata properties (discord-net#1639) * fixes discord-net#1495 * keep obsolete properties and return types for compatibility * missing properties for SocketInvite * Restore xml docs and change obsolete message Co-authored-by: Paulo <pnmanjos@hotmail.com> * docs: Add alternative documentation link * fix: IMessage.Embeds docs remarks * fix: Move and fix internal AllowedMentions object (discord-net#1727) * misc: VoiceRegions and related changes (discord-net#1720) * feature: Add role tags (discord-net#1721) * feature: Add user public flags (discord-net#1722) * feature: Add MessageFlags and AllowedMentions to message modify (discord-net#1724) * feature: Add MessageFlags and AllowedMentions to Modify * Change exception message * feature: Add GuildUser IsPending property (discord-net#1731) * Implemented Pending property * Implemented changes * fix: Missing MessageReference when sending files * meta: 2.3.0 * meta: Bump version to 2.3.1-dev * fix: Deadlock in DiscordShardedClient when Ready is never received (discord-net#1761) * fixed a deadlock in DiscordShardedClient during a failed Identify due to InvalidSession * fixed log * Don't wait ready before releasing semaphore Co-authored-by: Paulo <pnmanjos@hotmail.com> * fix: Private methods aren't added as commands (discord-net#1773) Fix breaking change introduced by discord-net#1521 Co-authored-by: Samuel <33796679+orchidalloy@users.noreply.github.com> Co-authored-by: Samuel <33796679+Samrux@users.noreply.github.com> Co-authored-by: Matt Smith <me@mattthedev.codes> Co-authored-by: Radka Gustavsson <radka.janek@redhat.com> Co-authored-by: bakabaka.bunbun <54648150+bakabun@users.noreply.github.com> Co-authored-by: Joe4evr <jii.geugten@gmail.com> Co-authored-by: Jack Fox <0xdeadbeef1@gmail.com> Co-authored-by: Joel Liechti <52202086+Joelius300@users.noreply.github.com> Co-authored-by: vrachv <52053491+vrachv@users.noreply.github.com> Co-authored-by: Still Hsu <dev@stillu.cc> Co-authored-by: Daniel Baynton <49287178+230Daniel@users.noreply.github.com> Co-authored-by: Still Hsu <5843208+Still34@users.noreply.github.com> Co-authored-by: Fyers <Fyers@web.de> Co-authored-by: quinchs <49576606+quinchs@users.noreply.github.com> Co-authored-by: Yeba <31899118+yebafan@users.noreply.github.com> Co-authored-by: Antonio Zdravkov Nikolov <antonioznikolov@gmail.com>
* Add invite events (create and delete) * Removed unused using * Fixing IInviteMetadata properties * Add two new fields to the gateway event * Better event summary and remarks * Change how to assign to target variable Co-Authored-By: Joe4evr <jii.geugten@gmail.com> * Applying suggested changes to TargetUserType * Renaming NotDefined to Undefined * Fixing xml docs * Changed the summary style format Co-authored-by: Joe4evr <jii.geugten@gmail.com>
Summary
This change will add the new gateway events related to invites, INVITE_CREATE and INVITE_DELETE, introducing a new class,
SocketInvite
.Notes
I'm not sure about three points in this PR that might require more opinions.
SocketInvite
and we don't keep invites in the cache (not sure if we should, since there's no event to update this cache so it'll always be outdated or require to update them manually via REST). Should we cache the invites? Should we change the return of INVITE_DELETE toSocketInvite
even if it only has the code, channel, and guild?SocketInvite
implementIUpdateable
and make it updateable via REST?