Commit Graph

3102 Commits

Author SHA1 Message Date
Mark
9ede6b905f docs: Fix incorrect and missing colour values for Color fields (#1426) 2019-11-29 21:58:04 -05:00
Chris Johnston
3ff4e3d506 fix: #1421 (in a better way) Return empty set when ActiveClients is null (#1422)
This change ensures that SocketUser.ActiveClients will not return null, but instead an empty set by default. This can happen if the client has not recieved a presence update for a user, or if the user is not cached.
2019-11-23 12:58:13 -05:00
Joe4evr
911523d56f docs: Fix the Comparer descriptions not linking the type (#1424) 2019-11-23 12:57:16 -05:00
Joe4evr
99d7135d09 nit: Utilize ValueTuples (#1393)
* Utilize ValueTuples (with polyfill)

* Rebase and remove polyfill
2019-11-09 14:58:49 -05:00
Chris Johnston
79a0ea9de3 Feature: CustomStatusGame Activity (#1406)
* Implement CustomStatusGame activity

Adds the CustomStatusGame class, which is the activity corresponding to the custom status feature.

* Remove unused import from Game.cs
2019-11-09 13:41:10 -05:00
Saulius Šaltenis
5439cbad5a fix: GetUsersAsync to use MaxUsersPerBatch const as limit instead of MaxMessagesPerBatch. (#1412)
Requests are now returning up to 1000 guild user entities instead of the previous 100.
2019-11-09 13:38:25 -05:00
Neuheit
f86c39de6a feature: Implemented Message Reference Property (#1413)
* Added support for Message References

* Removed unused usings, added debugger display, updated ToString override

* Changed snowflakes to be wrapped in an optional instead of a nullable.
2019-11-09 13:12:29 -05:00
Patrick Klaeren
7f0c0c9155 fix: add .NET Standard 2.1 support for Color (#1405)
* Add NETSTANDARD2_1 support for Color

* Remove all conditionals following PR
2019-10-25 23:38:41 +01:00
Christopher Felegy
fd204eeb7b ci: do not exit on failed robocopy 2019-10-24 17:08:35 -04:00
Christopher Felegy
a8cdadc0ec meta: copy only _site to docs-static 2019-10-24 16:59:21 -04:00
Chris Johnston
007b011f12 Cache regex instances in MessageHelper (#1403) 2019-10-24 15:52:45 +01:00
JT
65223a6bb6 meta: Fix packaging (#1402)
vibe check
2019-10-23 23:09:00 -04:00
Christopher Felegy
1794f95be1 meta: fix metapackage build
passing complicated arguments to the nuget pack command in azure
pipelines never works as you want it to
2019-10-23 15:43:19 -04:00
Chris Johnston
1c6ee72a9a docs: Fix #1394 Misworded doc for command params args (#1400)
This fixes the docs for the command service, where it specifies that arguments that use the params keyword are comma separated, when they are actually space separated.
2019-10-23 15:25:26 -04:00
JT
a08d529645 meta: Fix package publishing in azure pipelines (#1401)
* Fix package creation

* Replace deprecated nuget task
2019-10-23 15:23:13 -04:00
JT
d199d93ae4 meta: Fix .NET Core 3.0 compatibility + Drop NS1.3 (#1382)
* Update all dependencies and deal with warning/errors

* Add updated AsyncEnumerable implementation

* Fix broken target

* Cleanup

* Remove obsolete message

* typo

* Update azure pipelines

* Update samples to .NET Core 3.0

* Pull out test change

* Install the .net core 3 SDK on the ubuntu image for the time being

* Target net core 3 for the unit tests because pipelines
2019-10-22 22:50:12 -04:00
Chris Johnston
a61adb07e0 feature: #1381 Guild PreferredLocale support (#1387)
* Fix #1381 Guild PreferredLocale support

Adds support for getting and modifying a guild's preferred_locale. This is a language tag in IETF BCP 47 format, which works with the built-in CultureInfo.

While Discord only supports a number of cultures, I think that this restriction should be handled at the API and not by the wrapper. (Also easier on our end)

* Add PreferredCulture to IGuild

This property was defined in RestGuild and SocketGuild, so it only makes sense to make it part of IGuild as well.
2019-10-22 22:46:41 -04:00
Joe4evr
0bda8a4217 fix: patch todo in NamedTypeReader (#1392) 2019-10-03 16:35:48 -04:00
Kieran Boyle
0d54207a27 feature: support guild subscription opt-out (#1386) 2019-10-01 15:51:02 -04:00
JT
3d39704c6c test: fix coercion error with DateTime/Offset (#1388) 2019-10-01 15:48:35 -04:00
Still Hsu
fd3810e9fe docs: September 2019 Documentation Update (#1379)
* docs: adjust wording of ActivityType.Watching enum

Adjusts the xmldoc summary wording of the ActivityType.Watching enum to
fix a wording issue.

* Add D.NET Logo to Open Graph meta tags

* Update DescriptionGenerator
...And update color to suit the logo better

* Disable smooth scrolling due to user complaints

* Remove unnecessary spacing in sideaffix

* Update footer version

* Remove featherlight plugin

As it is unnecessary and can break image tags

* Adjust wordings regarding safe-handling of secrets

* Fix formatting for first bot token sample

* Add badges to homepage

* Minor wording fixes on terminal

* Update to higher quality PNG

* Add Discord.Net.Example in sln for build validation

* Clarify all instances of IAsnycEnumerable

* Clarify overridden props in SocketNewsChannel

* Add returns and params docs for SyncPermissionsAsync

* Remove/fix invalid XMLdoc strings

* Remove AppVeyor and add GitHub badge
2019-09-22 19:06:57 -04:00
Christopher F
7b9029dd91 feature: support X-RateLimit-Reset-After (#1372)
* feature: support X-RateLimit-Reset-After

Users may now optionally disable using the system clock to calculate
the ratelimit duration. This may be overrided globally, via
DiscordConfig, or per RequestOptions.

This change has been built and tested via the integrated test suite,
but has not been tested in the real world. Please verify this does not
break any of the edge-case ratelimits.

* patch: wire new config properties to ApiClient

* patch: update Reset-After parsing precision

This patch applies the changes made to parsing precision in 606dac3.
2019-09-21 09:24:37 -04:00
Chris Johnston
68eb71c175 (binbrk)feature: Support filtering audit log entries on user, action type, and before entry id (#1377)
* Support filtering audit log entries on user, type, and before id

Adds support for filtering audit log entires with GetAuditLogsAsync. Adds the ability to specify a userId and ActionType to filter. Exposes the beforeId filter which was already implemented, yet unused (even when requesting > 100 entries)?

Was thinking that this could expose overloads of GetAuditLogAsync that accepts a IUser and IAuditLogEntry, but dealing with all the combinations of these types may be excessive.

* use only stringbuilder for args instead of string interpolation
2019-09-20 18:36:02 -04:00
NeKz
c54867feba feature: update audit log models (#1373)
* Fix bugs

* Add missing properties

* Add missing properties to ChannelInfo

Remove UserLimit property

* Add missing properties to GuildInfo

Change ContentFilterLevel of type int? to ExplicitContentFilter of type ExplicitContentFilterLevel?

* Remove AvatarHash from MemberInfo

* Add missing doc comments

* Make ExplicitContentFilter public

* Add ChannelId property to overwrite audits

* Update doc comments based on feedback
2019-09-20 18:29:11 -04:00
Chris Johnston
606dac3e1a fix: Use double precision for X-Reset-After, set CultureInfo when parsing numeric types (#1375)
* Parse double for X-Reset-After instead of float, needs more precision

Float did not contain enough precision to store the millisecond unix
time value, which resulted in the second and millisecond values being
slightly off.

This can be easily tested using:

```cs
> DateTimeOffset.FromUnixTimeMilliseconds((long)(1470173022.123f *
1000)).Millisecond
160 // wrong

> DateTimeOffset.FromUnixTimeMilliseconds((long)(1470173022.123 *
1000)).Millisecond
123 // correct
```

* Parse RateLimit-Reset using an IFormatProvider

* State NumberStyle and use CultureInfo.InvariantCulture for any parsing

This updates most occurances in the code where a Parse or TryParse method was used to explicitly state the NumberStyle, and to use CultureInfo.InvariantCulture.
CultureInfo was used over NumberInfo, as it also works on DateTime parsing too.

* Use default format spec in Commands
2019-09-14 16:38:26 +00:00
Adam Gauthier
3755a027b3 feature: Provide ParameterInfo with error ParseResult (#1355)
Currently, when handling parsing errors, there is no way to know what
parameter caused the error. This change makes the CommandParser create
the parsing error with the current parameter info when ParseAsync()
fails. It is then available through the ErrorParameter of the
ParseResult.
2019-09-08 22:06:19 +00:00
Radka Janeková
b00da3d73c feature: add the "Stream" permission. (#1357) 2019-09-08 16:23:03 +00:00
Christopher Felegy
bcb3534195 change: use millisecond precision by default
this is More Precise and will allow us to handle ratelimits Much Easier
2019-09-08 11:28:27 -04:00
Christopher Felegy
3c6b3765ab test: target the Process env-var scope
This allows the integration tests to be run on unix-based systems.
2019-09-08 11:27:20 -04:00
Chris Johnston
9482204bcf feature: Add support for setting X-RateLimit-Precision (#1354)
* support X-RateLimit-Reset sending integer or float values

This changes the way that the X-RateLimit-Request header is parsed, so that it will work with both integer seconds and float values with seconds and milliseconds

* Add RateLimitPrecision enum, set X-RateLimit-Precision

Adds the RateLimitPrecision enum, with Second and Millisecond values. (Do we want to use an extension method to convert it into a string, or is ToString().ToLower() fine?)
Adds RateLimitPrecision as a parameter to DiscordRestApiClient, and to DiscordConfig so that it can set the X-RateLimit-Precision header.
2019-09-08 15:21:10 +00:00
Chris Johnston
07f4d5f353 [abibrk] change: Update ISystemMessage interface to allow reactions (#1368)
* Move reaction methods of IUserMessage to IReactionMessage

Moves the reaction-related methods contained in IUserMessage to the IReactionMessage type. Updates the type of ISystemMessage so that it implements IReactionMessage.

* Move rest reaction implementation to RestReactionMessage

Copies the reaction implementation from RestUserMessage to RestReactionMessage. Updates RestUserMessage and RestSystemMessage to be derived from RestReactionMessage instead of RestMessage.

* Move WS reaction implementation to SocketReactionMessage

Copies the reaction implementation from SocketUserMessage into SocketReactionMessage. Updates SocketSystemMessage and SocketUserMessage to use SocketReactionMessage as the base class.

* docs: update summary for ReactionMessage classes

* Remove ReactionMessage types, move reaction impl to IMessage

Removes the IReactionMessage and derived types, which was unnecessary since all classes derived from IReactionMessage were IMessage.

Moves the reaction implementation to IMessage and derived types.
2019-09-08 15:18:52 +00:00
Christopher Felegy
dcd9cdd13e lint: rename IsStream to IsStreaming
While it might be more proper to refer to a voice state as composing
a stream (i.e., the IVoiceState is a Stream), this property is ported
up most often to actual user entities. It makes more sense to
communicate that the user is streaming, rather than stating that the
user itself is a stream.

This is also more gramatically consistent with the other voice state
properties (e.g., IsMuted). Movement from noun-form to participle-form
remains inline with the past-participle form used on the other
properties.
2019-09-07 22:19:26 +00:00
Chris Johnston
9bb08c9ba4 feature: Add SelfStream voice state property (#1369)
* Add self_stream voice state property

Adds the self_stream property which is set true when a user is streaming a video to a voice channel

* use flags for selfstream state instead of its own prop
2019-09-08 02:08:40 +00:00
NeKz
b0a595be77 fix: Fix keys of guild update audit (#1371) 2019-09-08 02:05:10 +00:00
Chris Johnston
c977f2ec9c fix: #1314 Don't parse tags within code blocks (#1318)
* implement a fix for tags being found in code blocks

still needs polish, consider this a rough draft

* refactor to reuse a local function

uses CheckWrappedInCode to check that there are no code blocks that surround the tag being parsed

* Add more test coverage of MessageHelper.ParseTags

* reset indexes for @ here mention

* add a test case to catch error fixed from prev commit

* wip commit of most test cases working

* fix the Enclosed in block util method

* code cleanup

* lint whitespace

* lint brackets for single line if blocks

* move messagehelpertests to the new unit test dir

* expose internals to the unit test project

this seems to have been breaking the build, since CI would build the merged branch, where rest wasn't exposed to the unit tests
2019-08-25 13:28:05 +00:00
advorange
e8cb031704 fix: CommandExecuted event will fire when a parameter precondition fails like what happens when standard precondition fails. (#1346) 2019-08-25 13:22:30 +00:00
Chris Johnston
265da99619 feature: Add Quote Formatting (#1348)
* Implement Quote Formatting

Adds support for block quote text formatting. This feature is currently only implemented in the Canary client.
This formatting adds a "> " to each new line from the input text.

* add > char to character sanitization

* change assumptions around whitespace strings

* add blockquote (>>>) formatting + test
2019-08-25 13:14:24 +00:00
moiph
52565ed0de docs: Fixing GatewayEncoding comment (#1359)
Const, not a property
2019-08-25 13:09:55 +00:00
Chris Johnston
794eba5d1a feature: Add ChannelFollowAdd MessageType (#1358)
Adds the new MessageType for system messages indicating that a webhook for a news channel has been added to a text channel.
2019-08-18 22:37:58 +00:00
Kieran Boyle
15b2a36790 [ci skip] Removed duplicate "any" from the readme (#1353) 2019-08-12 13:34:00 +01:00
Saulius Šaltenis
af79ed54a1 docs: Fixed a spelling error. (#1349) 2019-07-30 15:22:43 -04:00
Christopher Felegy
2981d6bd80 ci: build and deploy docs automatically
commit ed3dac1cc7cb57b00e158273ab1487d5fb3e4eb3
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Sun Jul 21 21:38:26 2019 -0400

    merge docs into Windows_deploy

commit de7768e2ff710cf183310e8d843cffb2e50285d4
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Sun Jul 21 21:31:12 2019 -0400

    clone via ssh

commit 3b25b4508ae1476d17d91e6394c5bacf2721a1fc
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Sun Jul 21 21:27:15 2019 -0400

    use proper \ in folder command

commit 6a78a662ab21681fce2d9186888e92a3790752c0
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Sun Jul 21 21:24:37 2019 -0400

    nugget

commit 13064a6184b63ebafda540514391301412407638
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Sun Jul 21 21:17:26 2019 -0400

    yes, i am sure

commit 604b784e64fbbe24d8111bbfc53d59016871b244
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Sun Jul 21 21:12:49 2019 -0400

    use proper \ in windows commands

commit dd3954071433a1c10f42e8510bb7961d20a089d1
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Sun Jul 21 21:09:35 2019 -0400

    install docfx.console from NuGetCommand

commit 769693d834921217a51e15ef4ad34d0d7d612b33
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Sun Jul 21 20:59:58 2019 -0400

    fix syntax error

commit c8c4ea5439610f0591edbc56ee17384f6e87a162
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Sun Jul 21 20:57:31 2019 -0400

    ci: build docs
2019-07-21 21:39:38 -04:00
gab
120c0f72cb fix: Remove null coalescing on ToEmbedBuilder Color (#1333)
Very simple change, removes the null coalescing operator on the EmbedBuilder's Color property in ToEmbedBuilder.
2019-06-29 19:10:10 -04:00
Casino Boyale
4edda5b729 fix: Fixed attempting to access a non-present optional value (#1337) 2019-06-29 19:09:01 -04:00
Chris Johnston
9da11b4184 [ifcbrk] feature: Implement Client Status Support (#1247)
* Implement Client Status Support

Adds support for using the client_status as sent as part of the Presence model. This value can be used to determine if a user is active on the native desktop app, the mobile app, or the website.

* lint: whitespace in IPresence

* Remove breaking change to IPresence interface with a note for 2.1

* update comment to not reference 2.1

* re-add interface break to IPresence

* add example payload for client_status

* use inline declaration for Enum.TryParse
2019-06-22 23:46:20 -04:00
Christopher Felegy
c870e672a2 debug: temporary sanity checking in SocketGuild 2019-06-22 17:03:59 -04:00
Casino Boyale
c88b1dada7 [ifcbrk] feature: id overload for RemoveReactionAsync (#1310)
* Added id overload for RemoveReactionAsync

* Fixed the docs strings
2019-06-21 17:35:40 -04:00
Chris Johnston
faf23dee35 [ifcbrk] feature: BOOST (#1319)
* add new MessageTypes

* Add new properties to the updated models

* add the SystemChannelMessageDeny

unsure if there would be a better name for this enum, given it's inverted nature, open for suggestions

* add PremiumTier flag, add Guild description property

* add method for getting vanity image from CDN

* make the size of GetGuildVanityUrl optional

* lint: remove commented out code from prev commit

* add a None flag to SystemChannelMessage enum

* implement the new modify guild params

* implement additional model properties in IGuild types

* implement GuildMember PremiumSince

* docs: reword size param explanation

* add extension methods that make it easier to check the SystemChannelMessage flags for end users

because the flag is inverted, this ideally should make it easier for the user. it may also be useful to do something similar for modifying this property

* docs: correct typo from copy-paste

* add the premium_subscription_count property

* fix vanity url code and banner switchup

a mistake was made somewhere, that's all I know for sure

* clarify remark on inverted logic for system channel flags

* fix PremiumSubscriptionCount optional value

* add another example to the systemchannelflags xmldoc remark

* docs: fix typos, clarify wording

* use DateTimeOffset for PremiumSince, follow conventions from other prop
2019-06-21 17:34:45 -04:00
Christopher Felegy
d6d4429c3d fix: include MessageFlags and SuppressEmbedParams 2019-06-21 17:27:00 -04:00
Still Hsu
363d1c6da6 docs: Fix invalid cref values in docs (#1329)
Signed-off-by: Still Hsu <341464@gmail.com>
2019-06-21 17:23:02 -04:00