Commit Graph

3185 Commits

Author SHA1 Message Date
Paulo
ec673e1863 feature: Implement gateway ratelimit (#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
2020-11-18 23:40:09 -03:00
Paulo
97e71cd5e5 fix: Revert PremiumSubscriptionCount type (#1686) 2020-11-18 14:52:00 -03:00
Paulo
ec212b175d feature: Add missing properties to Guild and deprecate GuildEmbed (#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
2020-11-17 05:23:45 -03:00
Paulo
04389a4f3e fix: Emoji url encode (#1681) 2020-11-17 05:11:25 -03:00
Paulo
3a1001830b misc: Missing summary tag 2020-11-17 02:11:02 -03:00
Paulo
47ed806418 misc: Change ratelimit messages (#1678) 2020-11-15 13:20:08 -03:00
Paulo
be60d813f7 fix: Team is nullable, not optional (#1672) 2020-11-09 15:39:08 -03:00
Paulo
05a1f0a709 fix: Discord sends null when there's no team 2020-11-09 12:31:17 -03:00
Paulo
9134443494 fix: Crosspost throwing InvalidOperationException (#1671)
* Add INewsChannel

* Renaming variable to match the new type
2020-11-08 19:29:15 -03:00
Jack Fox
1e012ac0b8 feature: Add GetStreams to AudioClient (#1588)
* Added GetStreams

* Change return type

* Change return type on the interface

Co-authored-by: Paulo <pnmanjos@hotmail.com>
2020-11-08 18:21:51 -03:00
Paulo
10fcde0a32 feature: Add missing application properties (including Teams) (#1604)
* Add missing application properties

Add IsBotPublic, BotRequiresCodeGrant, and Team properties to IApplication

* To immutable list

* Change list to array
2020-11-08 18:13:41 -03:00
Paulo
1ab670b3fc feature: Add INVITE_CREATE and INVITE_DELETE events (#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>
2020-11-08 17:33:37 -03:00
Paulo
a2af9857ca fix: Audio stream dispose (#1667)
* Fix audio dispose

* Missed a few
2020-11-07 16:15:46 -03:00
bakabaka.bunbun
2592264acb feature: Add "View Guild Insights" to GuildPermission (#1619)
* feature: Add "View Guild Insights" permission

* Add missing summary

Co-authored-by: Paulo <pnmanjos@hotmail.com>
2020-11-07 16:10:13 -03:00
Radka Gustavsson
a80e5ff940 (ifcbrk) feature: Add includeRoleIds to PruneUsersAsync (#1581)
* Implemented include_roles for guilds/id/prune get&post

* Unnecessary using

Co-authored-by: Paulo <pnmanjos@hotmail.com>
2020-11-07 15:55:14 -03:00
Matt Smith
971d519e35 fix: GuildEmbed.ChannelId as nullable per API documentation (#1532) 2020-11-07 15:44:33 -03:00
Samuel
e40ca4a422 fix: Missing AddReactions permission for DM channels. (#1244)
Co-authored-by: Samuel <33796679+Samrux@users.noreply.github.com>
2020-11-07 15:26:33 -03:00
Paulo
084db253f3 fix: limit request members batch size
Discord is actually enforcing v8 limits on v6 according to https://github.com/discord/discord-api-docs/issues/2184
2020-11-06 11:30:42 -03:00
Paulo
ae9fff6380 fix: Check error 404 and return null for GetBanAsync (#1614) 2020-10-28 18:03:08 -03:00
Paulo
bd4516b035 (ifcbrk) fix: Add AllowedMentions to webhooks (#1602) 2020-10-28 17:52:06 -03:00
Paulo
43c8fc0535 fix: Voice overwrites and CategoryId remarks (#1608)
* Add overwrites to voice and change CategoryId docs

* Let's not forget another one
2020-10-28 17:51:16 -03:00
Alex Howe
03b831e691 fix: Update README.MD to reflect new discord domain (#1652)
The first link does not point to the correct discord domain, it seems the commit that should have fixed this missed this link.
2020-10-28 15:26:48 -04:00
Paulo
f396cd9b92 fix: Cancel reconnection when 4014 (#1603)
* Cancel reconnection when 4014

* Missed an else
2020-10-14 18:23:00 -04:00
mathewsjwh
e3925a77a3 feature: Added CultureInvariant RegexOption to WebhookUrlRegex (#1637)
Co-authored-by: Jake Mathews <jwm5vv@virginia.edu>
2020-10-14 18:21:42 -04:00
Paulo
fa5ef5e1c6 fix: handicap member downloading for verified bots (#1647) 2020-10-14 18:20:30 -04:00
Paulo
4b389f3ecf fix: Add missing permissions (#1642) 2020-10-14 18:05:59 -04:00
Paulo
3085e883b7 fix: Invoke UserUpdated from GuildMemberUpdated if needed (#1623) 2020-10-14 18:05:35 -04:00
Paulo
3860da002f fix: Do not update overwrite cache locally (#1622) 2020-10-14 18:04:43 -04:00
Samuel
c1d04b4d1a fix: Handle null PreferredLocale in rare cases (#1624)
Sometimes Discord messes up and leaves a guild with a null PreferredLocale, causing an error to be thrown. This fixes that from Discord.Net's end even though it's Discord's fault.
2020-10-14 18:03:13 -04:00
Paulo
366ca9a562 fix: Parse mentions from message payload (#1621) 2020-10-14 18:02:33 -04:00
Bram
df8a0f7cd6 Fix: Not using the new domain name. (#1571)
* Fix: Using the correct discord domain.

* Fix: Using the correct discord domain.

* Docs: Using the correct discord domain.

* Fix: Changed canary and ptb to the new domain.
2020-09-04 17:56:05 +01:00
Paulo
b95b95bdcb fix: Invite audit log without inviter (#1599)
* Fix possible invite without inviter

* Prevent the same for InviteCreate

* Update Creator property docs
2020-08-05 20:16:59 -04:00
Paulo
2f6c0175c8 fix: Different ratelimits for the same route (implement discord buckets) (#1546)
* Don't disable when there's no resetTick

Sometimes Discord won't send any ratelimit headers, disabling the semaphore for endpoints that should have them.

* Undo changes and change comment

* Add HttpMethod to BucketIds

* Add X-RateLimit-Bucket

* BucketId changes

- BucketId is it's own class now
- Add WebhookId as a major parameter
- Add shared buckets using the hash and major parameters

* Add webhookId to BucketIds

* Update BucketId and redirect requests

* General bugfixes

* Assign semaphore and follow the same standard as Reset for ResetAfter
2020-08-05 20:16:21 -04:00
Paulo
421a0c12cc feature: support reading multiple activities (#1520) 2020-08-01 12:43:56 -04:00
Paulo
2d80037f6b feature: Add missing channel properties (#1596) 2020-08-01 01:26:24 -04:00
Paulo
42ba3720e3 fix: Trim token before passing it to the authorization header (#1578)
* Trim token

* Trim when assigning to AuthToken
2020-07-18 13:52:23 -04:00
Mustafa Salih ASLIM
468f8264d0 fix: unsupported property causes an exception (#1469)
fix for: https://github.com/discord-net/Discord.Net/issues/1436

`SlowModeInterval` property causes an exception for Announcement Channel feature if it is enabled on discord. Should be checked whether it is specified or not before set to property.
2020-07-10 00:13:46 -04:00
Paulo
b8fa464125 fix: Stop TaskCanceledException from bubbling up (#1580) 2020-07-10 00:13:01 -04:00
JT
4fa6393329 meta: Fix CI/CD (#1583)
* Update build.yml

* Update azure-pipelines.yml

* Update examples to NC3.1
2020-06-27 15:20:30 -04:00
moiph
c42bfa6f4f docs: updating comments for privileged intents (#1576)
* Updating comments for privileged intents

* Moving updated comments to remarks

* Formatting
2020-06-20 19:48:55 -04:00
Paulo
dc8c95931e fix: Incomplete Ready, DownloadUsersAsync, and optimize AlwaysDownloadUsers (#1548)
* Fix Ready and AlwaysDownloadUsers

Ready could fire before downloading all guild data and downloading guild users one guild per time without gateway intents is a waste of a gateway request that can support up to 1000.

* Reduce batchSize and fix count

* Fix typo

* Split xml docs line

Co-authored-by: Christopher Felegy <cfelegy@riseup.net>
2020-06-18 00:00:10 -04:00
OhB00
a51cdf60a2 feature: allow for inherited commands in modules (#1521) 2020-06-17 23:53:26 -04:00
Paulo
ab32607bcc (ifcbrk) fix: Add AllowedMentions to SendFileAsync (#1531)
* Add AllowedMentions to SendFileAsync

* Update xml reference and mocked channels
2020-06-17 23:51:50 -04:00
Paulo
f2130f8513 feature: Add Direction.Around to GetMessagesAsync (#1526)
* Add Direction.Around to GetMessagesAsync

* Reuse the method

* Reuse GetMany

* Fix limit when getting from cache without message id

* Fix limit when getting from rest without message id

* Change cache return

It will return in a similar way to REST
2020-06-17 23:48:45 -04:00
moiph
d5d10d32cf feature: Support Gateway Intents (#1566)
* Support Gateway Intents

Allows supplying gateway intents through DiscordSocketConfig which will be passed through the IDENTIFY payload, in order to choose what gateway events you want to receive.

* Fixing enum casing

* Feedback

* Updating comment for GuildSubscriptions

* Comment update
2020-06-17 23:40:10 -04:00
Christopher Felegy
5227241ba5 ci: force dotnet restore to run without cache 2020-06-16 00:59:16 -04:00
Paulo
3325031f04 fix: AllowedMentions and AllowedMentionTypes (#1525)
* Give proper values to flag enum

* Add zero value

* Initialize lists

* Update xml docs
2020-06-16 00:45:19 -04:00
Christopher Felegy
3df05399ea nit: remove redundant CreateGuildRoleParams
CreateGuildRoleParams is identical to ModifyGuildRoleParams, so just use
the latter when creating new roles.
2020-06-15 00:29:16 -04:00
Bram
5430cc8df9 fix: Sending 2 requests instead of 1 to create a Guild role. (#1557)
The GuildHelper.CreateRoleAsync() was sending 2 requests to create a role. One to create the role, and one to modify the role that was created. This can be done in one request. So i have moved it to a single request to lower the amount of requests send to the api. This will also solve issue #1451.
2020-06-15 00:11:05 -04:00
Paulo
a89f0761f4 feature: Add MESSAGE_REACTION_REMOVE_EMOJI and RemoveAllReactionsForEmoteAsync (#1544)
* Add event and method

* Simplify convert to IEmote
2020-06-15 00:04:34 -04:00