Commit Graph

3155 Commits

Author SHA1 Message Date
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
Joe4evr
42826df5e4 nit: minor refactor to switch expression (#1561) 2020-06-15 00:03:23 -04:00
Paulo
bd4672ae21 fix: InvalidOperationException at MESSAGE_CREATE (#1555)
## Summary

If PartyId isn't present, Discord.Net will throw an InvalidOperationException and not raise `MessageReceived`.
Got this a few times with my bot, stacktrace:
```
System.InvalidOperationException: This property has no value set.
   at Discord.Optional`1.get_Value() in ...\Discord.Net\src\Discord.Net.Core\Utils\Optional.cs:line 20
   at Discord.WebSocket.SocketMessage.Update(ClientState state, Message model) in ...\Discord.Net\src\Discord.Net.WebSocket\Entities\Messages\SocketMessage.cs:line 157
   at Discord.WebSocket.SocketUserMessage.Update(ClientState state, Message model) in ...\Discord.Net\src\Discord.Net.WebSocket\Entities\Messages\SocketUserMessage.cs:line 58
   at Discord.WebSocket.SocketUserMessage.Create(DiscordSocketClient discord, ClientState state, SocketUser author, ISocketMessageChannel channel, Message model) in ...\Discord.Net\src\Discord.Net.WebSocket\Entities\Messages\SocketUserMessage.cs:line 53
   at Discord.WebSocket.DiscordSocketClient.ProcessMessageAsync(GatewayOpCode opCode, Nullable`1 seq, String type, Object payload) in ...\Discord.Net\src\Discord.Net.WebSocket\DiscordSocketClient.cs:line 1210
```

After looking all properties, this is the only one that could be blamed and was already fixed for `RestMessage`s, see #1337 

## Changes

- `Value` to `GetValueOrDefault()` for `PartyId`
2020-06-15 00:02:51 -04:00
Paulo
57880de5b8 (ifcbrk) Add SearchUsersAsync (#1556) 2020-06-15 00:02:23 -04:00
Paulo
323a6775ee misc: MutualGuilds optimization (#1545)
* Check Dictionary

Check Dictionary instead of creating a new IReadOnlyCollection and looping in it

* Add Remark to MutualGuilds
2020-05-24 23:38:25 -04:00
Paulo
30b5a833d2 feature: Add GetUsersAsync to SocketGuild (#1549)
* Add GetUsersAsync to SocketGuild

* Fix IGuild return

* Do not download unless needed
2020-05-24 23:37:21 -04:00
moiph
758578955e misc: update webhook regex to support discord.com (#1551)
* Updating webhook regex for discord.com

Updates webhook URL regex matching for discordapp.com and discord.com

* Fixing comment

* Whitespace
2020-05-24 23:36:05 -04:00
Matt Smith
a6c1e4c23f (ifcbrk) feature: news channel publishing (#1530)
* Added PublishAsync to Messages.

* Added missing implementation.

* 1. Aligned with naming standards
2. Clarified xml docs
3. Properly threw exceptions instead of failing silently.

* Additional documentation included.

* Removed un-needed comments.

Co-authored-by: Matt Smith <v-matsm@microsoft.com>
2020-05-20 17:28:23 -04:00
Paulo
91b270a0ce fix: handle GUILD_DELETE behavior correctly (#1542) 2020-05-20 17:25:49 -04:00
FiniteReality
08d9834e2c fix: Ensure resetAt is in the future
If the current reset time is in the past, then somebody else in the
current bucket must have made a request before we were able to. To
prevent accidental ratelimits, we fall-back to the second sleep
branch, as if the reset time wasn't specified at all.

Additionally Extracts the minimum sleep time to a constant, and also
bumps it to 750ms.
2020-05-18 18:06:30 +01:00
FiniteReality
d294678ed5 fix: use UtcNow when computing reset tick 2020-05-18 16:48:56 +01:00
Joe4evr
0c16d2f538 misc: Use '??=' (rebased) (#1391)
Co-authored-by: Christopher Felegy <cfelegy@riseup.net>
2020-05-07 09:21:30 -04:00
TheKingEagle
03af8e0bb4 fix: Call GuildAvailableAsync for dispatch(GUILD_CREATE) case (#1473)
* Fix for Issue #1471

This change will allow `GuildAvailable` to fire when the client joins a new guild, as well as properly update `IsConnected`.

* Removed unnecessary statement;
2020-05-07 09:19:15 -04:00
Joe4evr
c68cc85895 feature: Add cache purging methods (#1478) 2020-05-07 09:16:57 -04:00
Arnav Borborah
b6c981227d docs: Use Timeout.Infinite instead of -1 so that intent is clearer (#1443) 2020-05-07 09:14:37 -04:00
Chris Johnston
89b6b7e1a5 feature: Include allowed mentions payload on message creation (#1455)
* Feature: Allowed mentions object on msg create (interface breaking)

This change implements the AllowedMentions object for the payload of message creation. By default, the mentions behavior remains unchanged, the message content is parsed for all mentionable entities and they are all notified. If this payload is not null, it will use the content of the allowed_mentions field to determine if a role is notified, or just displayed.

This change is interface breaking. This follows the conventions of keeping RequestOptions as the last argument, but could break some users who specify each of these arguments without using named arguments.

* lint: remove commented-out code

This change removes the commented-out code which was added during testing from the previous commit.

* fix interface break: reorder allowedMentions arg so that it's after options

This change modifies the order of the AllowedMentions argument of SendMessageAsync so that this addition shouldn't be interface breaking. The downside to this change is that it breaks the convention followed by other methods, where the RequestOptions argument is normally last.

* docs: fix typo in allowedMentions arg doc

* fix interface break arg from IRestMessageChannel

* docs: update xmldoc for allowedMentions args

* fix interface breaking arg order for ISocketMessageChannel

* fix mocked classes that weren't updated

* fix: RestDMChannel#SendMessageAsync bug, allowed mentions always null

This change fixes a bug that was introduced while testing changes to the interface of the SendMessageAsync method to try and retain interface compatibility

* docs: update xmldoc for AllowedMentions type

* docs: reword xmldoc of AllowedMentionTypes type

* docs: fix typo

* fix: validate that User/Role flags and UserIds/RoleIds lists are mutually exclusive

This change adds validation to SendMessageAsync which checks that the User flag is mutually exclusive with the list of UserIds, and that the Role flag is also mutually exclusive with the list of RoleIds

* docs: reword summaries for AllowedMentions type

* Add util properties for specifying all or no mentions

Adds read only properties which specify that all mentions or no mentions will notify users. These settings might be more common than others, so this would make them easier to use.

* docs: Resolve PR comments for documentation issues/typos
2020-05-07 09:13:57 -04:00
Paulo
f8b2b5627e fix: Move content check for ModifyMessage (#1503)
good catch, thanks!
2020-05-07 09:12:08 -04:00
NeKz
41543a8084 fix: Fix Deserialization in Audit Log Data Types (#1509)
* Get overwrite id and type from options

* Create overwrites via API model
2020-05-07 09:09:46 -04:00
NeKz
479e28358e feature: Implement missing audit log types (#1458)
* Implement missing audit log types

* Use IUser properties
2020-05-07 09:04:33 -04:00
Monica S
ed869bd78b [apibrk] change: Specify WebSocket close code (#1500)
* API breaking change: Specify WebSocket close code

Should fix #1479 and help overall with resuming sessions.

* Also try to resume on missed heartbeats
2020-04-25 12:12:57 +01:00
Yamboy1
6d8e216545 docs: Small typo in documentation (#1460) 2020-04-22 02:10:38 -04:00
Still Hsu
106f346ddb docs: 2020 April Documentation Maintenance (#1484)
* Add doc page for Named Arguments

* Implement minor stylistic changes

* Update docfx.json to support NS2.0

Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com>

* Fix broken xref in basic-operations

* Fix broken crefs

* Fix wordings in named argument

* Fix misleading warning about long-running code

* Fix misleading CommandService summary

Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com>

* Update copyright year and version

Signed-off-by: Still Hsu <5843208+Still34@users.noreply.github.com>

* Escape example captions

* Add warning regarding FlattenAsync for GetReactionUsersAsync

* Fix a minor grammar mistake

Co-authored-by: Joe4evr <jii.geugten@gmail.com>
2020-04-22 02:04:10 -04:00
Min
1f01a2d1fa fix: nullcheck _shards before iterating (#1493) 2020-04-22 02:02:22 -04:00
Christopher Felegy
c637bab91a meta: bump to 2.3.0-dev 2020-04-16 21:48:45 -04:00
Christopher Felegy
8d9e9714f7 meta: bump version to 2.3.0-dev 2020-04-16 21:44:53 -04:00
Christopher Felegy
4b602b4517 meta: 2.2.0
free chick fil a for whomever writes the changelog
2020-04-14 20:53:05 -04:00
Christopher Felegy
6ed311bc73 meta: 2.2.0 2020-04-14 20:50:55 -04:00
Christopher Felegy
91aec9ff93 add idn debugger
where is my foxboat
2020-04-14 20:47:36 -04:00
Braedon Smith
adf823ca9a Added System.Linq reference (#1470)
Use of IReadOnlyCollection#Any requires a reference to System.Linq. It's a small thing, but better copy-paste-ability is never a bad thing.
2020-03-31 15:03:11 +01:00
NovusTheory
d734ce0a11 feature: Add ability to modify the banner for guilds (#1432) 2019-12-26 18:44:01 -05:00
Chris Johnston
a4846516fb fix: false-positive detection of CustomStatusGame based on Id property (#1416)
This change fixes a bug that was introduced in PR #1406. Games were falsely detected to be CustomStatusGames, based on the Id property being included in the model payload.

This fixes the false detection of Games as CustomStatusGame. An activity will only be considered a CustomStatusGame if the Id has a value of "custom".

This change has been tested by listening to the GuildMemberUpdated event, and opening/closing games with a custom status set.
2019-11-29 22:13:08 -05:00