Commit Graph

3076 Commits

Author SHA1 Message Date
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
Casino Boyale
9fede346d3 feature: Added a Rest property to DiscordShardedClient (#1326)
* Added a Rest property to DiscordShardedClient

* Moved the rest client onto the BaseSocketClient
2019-06-21 17:22:32 -04:00
Passive
c864f48c3b lint: Fix spelling mistake in ExclusiveBulkDelete warning (#1330) 2019-06-21 17:21:22 -04:00
Alex Gravely
0484fe8e9d docs: Change token explanation (#1331)
man I wish people read more
2019-06-21 17:20:19 -04:00
Christopher Felegy
cd288923c3 [ifcbrk] feature: suppress messages
yeah man I support the first amendment
2019-06-21 17:18:29 -04:00
Passive
1e8aa080ab Fix #1327 Color.ToString returns wrong value (#1328)
* Match debugger display value

https://github.com/discord-net/Discord.Net/issues/1327

* Use string.format to convert raw value to hex

* Remove nested string.format
2019-06-21 16:28:44 +01:00
Chris Johnston
a797be9ca0 test: Split Unit and Integration tests into separate projects (#1290)
* Squashed commit of test rewrite changes

fix missing priority speaker flag

rewrite the TestChannelPermissionModify test

add test for GuildPermission modify

separate unit and integration tests, start writing channel and guild permission tests

copy over the color tests

copy over the emote tests

copy the token utils tests

make the mocked entities sealed classes

copy the TypeReaderTests class

properly dispose the CommandService in the TypeReaderTests

start writing tests for EmbedBuilder and related classes

test that properties throw ArgumentException when invalid

add tests for the embed length property

add withFooter tests

finish adding tests to EmbedBuilder

fix bug in value validation of EmbedFieldBuilder

hey, these tests actually found a bug!

add tests for the MentionUtils class

add tests for the Format util class

remove all of the old tests

add analyzer tests (copied from old tests)

add tests for the SnowflakeUtils class

add integration tests

these get around the issue of state persisting between tests by creating and deleting a guild for each set of tests. these shouldn't be run excessively because of the rate limits, but should be fine every now and then

remove unnecessary launchSettings.json

update outdated string

don't create a new guild each time, as that can result in errors

this can happen if a bot creates too many guilds without properly deleting them

add some tests that show that guild can be modified

await async assert

add more measures that created channels are deleted when done

remove "Test" prefix from test method names

I think that this prefix when already displayed under a class with a suffix of "Tests" is redundant

Remove mention of old test project

fix an issue from forgetting to await Assert.ThrowsAsync

explicitly disable parallelization on integration tests

add test for GuildPermission modify

separate unit and integration tests, start writing channel and guild permission tests

copy over the color tests

copy over the emote tests

make the mocked entities sealed classes

properly dispose the CommandService in the TypeReaderTests

fix bug in value validation of EmbedFieldBuilder

hey, these tests actually found a bug!

add tests for the MentionUtils class

add tests for the Format util class

remove all of the old tests

add analyzer tests (copied from old tests)

add tests for the SnowflakeUtils class

add integration tests

these get around the issue of state persisting between tests by creating and deleting a guild for each set of tests. these shouldn't be run excessively because of the rate limits, but should be fine every now and then

remove unnecessary launchSettings.json

update outdated string

don't create a new guild each time, as that can result in errors

this can happen if a bot creates too many guilds without properly deleting them

add more measures that created channels are deleted when done

remove "Test" prefix from test method names

I think that this prefix when already displayed under a class with a suffix of "Tests" is redundant

Remove mention of old test project

fix an issue from forgetting to await Assert.ThrowsAsync

explicitly disable parallelization on integration tests

update the azure CI build script

separate execution of test projects so that if one fails the other will not pass

one of the unit tests failed, but the analzyer tests passed

fix test that would break in different timezones

enable the integration tests (only on dev branch)

* Squashed commit of test rewrite changes

fix missing priority speaker flag

rewrite the TestChannelPermissionModify test

add test for GuildPermission modify

separate unit and integration tests, start writing channel and guild permission tests

copy over the color tests

copy over the emote tests

copy the token utils tests

make the mocked entities sealed classes

copy the TypeReaderTests class

properly dispose the CommandService in the TypeReaderTests

start writing tests for EmbedBuilder and related classes

test that properties throw ArgumentException when invalid

add tests for the embed length property

add withFooter tests

finish adding tests to EmbedBuilder

fix bug in value validation of EmbedFieldBuilder

hey, these tests actually found a bug!

add tests for the MentionUtils class

add tests for the Format util class

remove all of the old tests

add analyzer tests (copied from old tests)

add tests for the SnowflakeUtils class

add integration tests

these get around the issue of state persisting between tests by creating and deleting a guild for each set of tests. these shouldn't be run excessively because of the rate limits, but should be fine every now and then

remove unnecessary launchSettings.json

update outdated string

don't create a new guild each time, as that can result in errors

this can happen if a bot creates too many guilds without properly deleting them

add some tests that show that guild can be modified

await async assert

add more measures that created channels are deleted when done

remove "Test" prefix from test method names

I think that this prefix when already displayed under a class with a suffix of "Tests" is redundant

Remove mention of old test project

fix an issue from forgetting to await Assert.ThrowsAsync

explicitly disable parallelization on integration tests

add test for GuildPermission modify

separate unit and integration tests, start writing channel and guild permission tests

copy over the color tests

copy over the emote tests

make the mocked entities sealed classes

properly dispose the CommandService in the TypeReaderTests

fix bug in value validation of EmbedFieldBuilder

hey, these tests actually found a bug!

add tests for the MentionUtils class

add tests for the Format util class

remove all of the old tests

add analyzer tests (copied from old tests)

add tests for the SnowflakeUtils class

add integration tests

these get around the issue of state persisting between tests by creating and deleting a guild for each set of tests. these shouldn't be run excessively because of the rate limits, but should be fine every now and then

remove unnecessary launchSettings.json

update outdated string

don't create a new guild each time, as that can result in errors

this can happen if a bot creates too many guilds without properly deleting them

add more measures that created channels are deleted when done

remove "Test" prefix from test method names

I think that this prefix when already displayed under a class with a suffix of "Tests" is redundant

Remove mention of old test project

fix an issue from forgetting to await Assert.ThrowsAsync

explicitly disable parallelization on integration tests

update the azure CI build script

separate execution of test projects so that if one fails the other will not pass

one of the unit tests failed, but the analzyer tests passed

fix test that would break in different timezones

enable the integration tests (only on dev branch)

* Update mocked channels for changed SendFileAsync signature

* comment out the integration tests from the build script

no bot token is provided to this script, and use of integration tests in CI is questionable here

* force rebuild because Azure linux build broke
2019-06-12 16:08:03 -04:00
Chris Johnston
40844b9e13 feature(binbrk): Add properties missing from User and Activity models (#1237)
* WIP commit, update IActivity and IUser with missing types

* incomplete implementation of interfaces

* Add implementation of activity flags, and extension method to check flag

* remove usings that were not required

* clean up files and add documentation where missing

* remove unused usings

* Add remark saying that premium_type info may be inaccessible to bots

it seems that this information can not be accessed by any user,
and may require the identity oauth scope

* Add locale property to the user model

adds the locale property to the user model, which appears not to be
specified for bots

* rename ActivityFlags

* Add incomplete xmldoc to ActivityFlag

Added xmldoc to the ActivityFlag type, excluded flags that i was unsure about

* rename the UserFlags file

* Add incomplete xmldoc to UserFlag enum

* Remove unnecessary extension methods and use built-in functionality

* use <c> tag for xmldoc 'null's

* Add xmldoc for JoinRequest ActivityFlag

* improve the PremiumType xmldoc

* Add zero activityflag

* Add summary tag verbs, example of IUser locale

* Rename Flag enum types to use Properties suffix

* Expose the details field in the Game model

* update Activity extension methods to support Details field

* Use inherited Details implementation in RichGame

* lint: remove commented out code from debugging

* Fix issue in previous commit

* Move oauth-only user fields to SelfUser classes

Moves the implementation of the Flags, PremiumType, and Locale user fields to ISelfUser classes. In testing, it seemed that normal bot accounts did not have this information supplied to them. When tested with a Bearer token in the Rest client, these fields are set.

* remove old HypeSquadEvents flag that appears to have been replaced with the new HypeSquad flags
2019-06-12 16:00:30 -04:00
Christopher Felegy
10463cfdd2 meta: bump version to v2.2.0-dev, update CHANGELOG 2019-06-08 23:13:11 -04:00
Christopher Felegy
dfd82a5ab7 meta: v2.1.1 2019-06-08 20:14:45 -04:00
Christopher Felegy
d287ed1d4c fix: add EmbedTypeConverter with unknown handling
Prevents messages with an unknown EmbedType from failing to unmarshal
2019-06-08 19:40:07 -04:00
Casino Boyale
1cc5d7321b fix: fixed optionals having IsSpecified true when objects weren't in cache (#1323)
* Fixed optionals having IsSpecified true when objects weren't in cache

* Removed double null check
2019-06-06 16:22:34 -04:00
Christopher Felegy
2e95c4913b fix: ignore escape behavior on remainder parameters (#994)
Co-authored-by: Quahu <quahu@gmail.com>
2019-06-05 17:13:29 -04:00
Christopher Felegy
a8c853f1ec Revert "Merge remote-tracking branch 'quahu/dev' into dev"
This reverts commit 8fb0d5dc13, reversing
changes made to 3e65e03b85.
2019-06-05 17:11:06 -04:00
Christopher Felegy
8fb0d5dc13 Merge remote-tracking branch 'quahu/dev' into dev 2019-06-05 17:07:42 -04:00
Christopher Felegy
3e65e03b85 meta: bump Ix.Net to 3.2.0 2019-06-05 16:47:57 -04:00
Christopher Felegy
46da3523d0 docs: update TextChannelProperties to 6-hour slow mode 2019-06-05 16:37:55 -04:00
Chris Johnston
fc48c6606d feature: Disconnect guild members from voice channels (#1311)
* Feature: Disconnect users from voice channels

Updates GuildUserProperties to allow for setting either Channel or ChannelId to null, which will disconnect users from voice channels.

The type of ChannelId has been updated from a ulong to ulong?, which matches the latest api documentation.

* docs: update xmldoc wording

* breaking workaround, revert ChannelId to ulong

This is a workaround to prevent this PR from being a breaking
change. Reverts the type of GuildUserProperties#ChannelId to a
ulong from a ulong?. Guild Users may no longer be kicked by
setting this property to null, but setting
GuildUserProperties#Channel should still work.
2019-06-05 13:41:18 -04:00
Jyrka98
4433ca741b fix: Update maximum value for SlowModeInterval (#1320)
Discord allows the slow mode to be up to 6 hours.
2019-06-05 11:55:50 -04:00
Christopher Felegy
63ccd05faa lint: newline on Emote#GetHashCode 2019-06-04 14:05:59 -04:00
Tiago Cabral
1b54883896 fix: Changed Emote GetHashCode to not include Name (#1317)
Continuation of commit abf3e90 attempt to fix Emote comparisons,
as Hash comparisons are done before Equals in Comparers
2019-06-04 14:04:53 -04:00
Casino Boyale
abf3e905f2 fix: Changed Emote equals to not compare emote names (#1316)
In reference to what was discussed in the dnet channel.
2019-06-03 13:14:20 -04:00
Chris Johnston
1f55f01866 feature(internal): Set the @everyone IRole for @everyone and @here tags (#1313)
* Set the @everyone IRole for @everyone and @here tags

Adds support for setting the IRole corresponding to @everyone or @here in a the tags of a message. Previously this would only set the TagType, but leave the value as null.

This does not distinguish between @everyone and @here, as that's done using TagType. The values of both will be the same.

This issue was suggested by @TheCasino

* use the EveryoneRole property

oops

* use null conditional operator instead of a null check
2019-06-02 19:53:26 -04:00
Christopher Felegy
4d7de176d0 meta: add versioning guarantees to README 2019-06-02 19:52:39 -04:00
Christopher Felegy
c78a6790b1 fix: don't raise REST log events twice
The DiscordSocketClient and DiscordSocketRestClient share the same
backing API client, so the Log events on both clients will be raised
from the same API calls. Proxying log events from the
DiscordSocketRestClient then means that the Log event the user hooks
into will be raised twice for a single log message.

Thanks to @TheCasino for noticing this.
2019-05-19 12:16:37 -04:00
Christopher Felegy
bc66d7ea4e meta: bump version to 2.1.1-dev 2019-05-19 12:14:36 -04:00
Christopher Felegy
c9e2c034f8 ci: use buildTag variable 2019-05-19 10:43:37 -04:00