Commit Graph

412 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
f3b20b2b6d feature: Add support for spoiler formatting & attachments (#1255)
Resolves #1216.

* Add support for spoiler formatting

* Implement support for sending message attachments that are spoilers

* use consistent naming

* update docstring for new isSpoiler param

* move extension method to be under core project, make spoiler prefix a const

* typo fix

* update missing xmldocs

* move SpoilerPrefix const outside of interface

* Add isSpoiler support to webhook client

adds the isSpoiler field to uploading files with a webhook, which will only
insert "SPOILER_" to the start of the filename. This does not include other
fields in the payload, as this is not in the documentation, and was not observed
like in the regular client
2019-05-17 19:28:40 -04:00
GreemDev
b52b54d80c fix: EmbedBuilderExtensions no longer has an extension for WithAuthor(IGuildUser). (#1294)
The embed should not display nickname#discriminator as that's incorrect.
So the extension was scrapped altogether to use the IUser (and by inheritance, IGuildUser) one.
2019-05-13 18:30:38 -04:00
Still Hsu
4309550ca0 docs: Main docs update (#1304)
* Remove template in favor of official samples

* Fixed a variable name copy pasta mistake

line 35 was _database.GetData() instead of DBService.GetData()

* Experimental theme change

* Change paragraph, code, heading fonts
* Widen viewport

* Update DocFX.Plugins.LastModified v1.2.3

* Exclude Discord.API in docs

* Add remarks for SocketReaction properties

* Add examples for BaseSocketClient.Events

* Add additional clarification for some methods

* Move IUser and IGuildChannel examples

* Clarify several guides samples with notes

- Reword TypeReader comment to avoid giving the idea that the sample itself is "obsolete"
- Remove CommandException logging comment regarding C#7.0 as the version is now the standard across VS2017 and up
- Remove suggestion about handling result in command handler since it is now advised to use CommandExecuted instead
+ Add additional comment to clarify ctor for DI setup

* Add/migrate code examples

* Incorporate material design theme

License @ https://github.com/ovasquez

* Update installation and nightly guide

* Fix improper indentations made obvious by the widen viewport
* Fix minor grammar issues
+ Add installation for nightly build using dotnet CLI

* Fix nav level indentation

* Revise "Your First Bot" article

* Merge some paragraphs to avoid clutter while keeping readability
* Reword the use of command framework
+ Add additional warning/note about environment variable

* Add additional indent level

* Fix indentation text warping

* Remove connections sample

* Update logging sample

Remove redundant part of the sample

* Remove mention of RPC

* Remove misleading section about commands

- Remove command sample from complete snippet
* Revise "Your First Bot" command paragraphs
* Change wording to hint devs that additional command parser packages may be available, as more and more begin to crop up

* Update themes

* Add XML docs contribution guidelines


Update guidelines

* Update CommandExecuted remarks

* Fix precondition remarks typo
no one saw that ok

* Fix permission sample in docfx

* Fix IMessageChannel samples

* Update docs/_template/light-dark-theme/styles/docfx.vendor.minify.css

Co-Authored-By: Still34 <341464@gmail.com>

* Update docs/_template/light-dark-theme/styles/material.css

Co-Authored-By: Still34 <341464@gmail.com>

* Update docs/_template/light-dark-theme/styles/material.css

Co-Authored-By: Still34 <341464@gmail.com>
2019-05-13 18:29:47 -04:00
Chris Johnston
bb61efabf3 feature: Check for whitespace or newline characters in tokens (#1305)
* Trim whitespace from tokens before logging in

This change trims whitespace characters from the supplied token before it is used to log in. Users can encounter this accidentally if they read their token from a file that ends with a blank line.

Leading whitespace will make the token invalid. Trailing whitespace or \n (not \r\n) will also fail to log in. \r\n (CRLF) doesn't fail because of the line break style for http request headers.

* revert trimming api token

* add check for whitespace or newline characters to existing token validation

Checks to see if a token contains any illegal characters, like whitespace or a newline. If it is, throws an ArgumentException warning the user that their token may be invalid.

I considered only checking the first and last character, but given that a token containing whitespace or a newline wouldn't work either I figured this made sense.

* removed unused usings

These were leftover from a previous approach using an ImmutableHashSet
2019-05-13 18:27:45 -04:00
Still Hsu
00d3f5a8e5 feature: Add GuildMemberJoin MessageType(#1263) 2019-05-04 17:08:18 -04:00
Chris Johnston
9084c4214e feature: Fix #1280 Add NewsChannel Types (#1293)
* add News channel type

* remove (very outdated) todo

* add [Socket/Rest]NewsChannel types

* update TextChannel properties to include a Type optional parameter with validation

as of writing, this feature is still only available to verified guilds, which makes it impossible for testing.

* actually create the news channels when given the type

* throw NotSupportedException in News channel

throw a NotSupportedException whenever trying to use SlowModeInterval or anything related to overwrite permissions

* make RestNewsChannel throw NotSupportedException also

* remove the (untested) ability to change channel types
2019-05-04 17:07:31 -04:00
Christopher Felegy
5569873717 fix: PacakgeReference belongs under an ItemGroup 2019-03-26 16:57:44 -04:00
Christopher Felegy
8003ac80e4 dep: flag IDisposableAnalyzers as private, bump version 2019-03-26 16:56:24 -04:00
Chris Johnston
48b327be3e fix: fix false invalidation when decoding token User Ids (#1278)
* add a util method for padding base64 strings if they are not of an expected length

* return the original string if it already contains padding, do not throw

* add tests for padding method, and for token that needs padding
2019-03-16 14:34:50 -04:00
Still Hsu
0fecdf69bb docs: Documentation December Update (#1218)
* Fix broken link (#11)

* Fix typos and improve wording

* Add information for IGuildUser

+ Add GetPermission sample
+ Add ModifyAsync remarks

* Add information for IGuildChannel

+ Add ModifyAsync remarks
+ Add GetOverwritePermissionAsync examples

* Add warning for Direction.Around

* Fix indentations and references

* Move IRole.ModifyAsync sample

* Add information for IUser

+ Add example, remarks for Get(Default)AvatarUrl
+ Add example, remarks for GetOrCreateDMChannelAsync
+ Add missing remarks/summary/returns for other properties of the class

* Change verbs used in IVoiceState summary/remarks

* Add additional explanation for IGuildUser.RoleIds

* Change verbs used in IMessage summary/remarks

* Clarify IUserMessage Add/RemoveReactionAsync samples

* Fix command handler sample typo

* Add information for DiscordSocketConfig

+ Add remarks/example to the class
+ Add remarks to AlwaysDownloadUsers

* Fix documentation for SlowMode

* Add additional remarks for Guild/TextChannelProperties

* Update DocFx.Plugins.LastModified to v1.2.0
This should drastically improve docfx build time.

* Add missing dependencies

* Update DocFx.Plugins.LastModified to v1.2.1

Improve performance

* Update DocFx.Plugins.LastModified to v1.2.2

* Clarify deployment.md

+ Rewritten .NET Core deployment strategies for better clarification
    * Split deployment types into framework-dependent and self-contained
    * Clarify the benefits of using different types of publishing
    * Include a sample of how to execute dotnet application with the dotnet command in a TIP dialog for visibility

* Update post-execution article and samples

+ This change is to reflect changes made in https://github.com/RogueException/Discord.Net/pull/1164, where CommandInfo is now passed into the CommandExecuted event as an Optional<T>

* Update DocFX.Plugin.DescriptionGenerator to v1.1.1

* Adjust according to recent CommandExecuted changes

See:
+ f549da50e0
+ 6260749095

* Add further documentation for https://github.com/RogueException/Discord.Net/pull/1037

* Add partial documentation for the precondition helper class

* Include CHANGELOG.md in docs

* Revise post-execution docs
* Fix incorrect Optional<T> usage
* Indent some sample code and add a comment reminding the user that the post-execution basic sample code is not ideal.

* Streamline docs for Attachment
+ This commit also adds further explanation for why Embeds and Attachments are read-only collections

* Add further documentation for MessageActivity and MessageApplication

* Add caching-related docs to ISocketMessageChannel

* Add missing documentation inheritance for SyncPermissionsAsync

* Streamline documentation process

This is done by changing the documentation of the implementations required by interfaces to redirect to the interface method instead (e.g., SocketDMChannel#GetMessagesAsync refer to IMessageChannel.GetMessagesAsync within the remarks of the method).

* Cleanup 92bf8363ca

* Update src/Discord.Net.Core/Entities/Channels/Direction.cs

Co-Authored-By: Still34 <341464@gmail.com>

* Update src/Discord.Net.Core/Entities/Channels/Direction.cs

Co-Authored-By: Still34 <341464@gmail.com>

* Update src/Discord.Net.Core/Entities/Channels/GuildChannelProperties.cs

Co-Authored-By: Still34 <341464@gmail.com>

* Update src/Discord.Net.WebSocket/DiscordSocketConfig.cs

Co-Authored-By: Still34 <341464@gmail.com>

* Update according to PR suggestions

* Reword sentences of deployment article for clarification & remove mention of portability
* Fix typos/grammar errors within TextChannelProperties

* Add the logo SVG to the page navbar

* Implement changing logo image based on theme color using CSS background image

* Add a favicon

* use the purple logomark instead of white

* hack? set the title to navbar svg to read "Discord.Net Docs"
2018-12-28 08:49:02 -08:00
Christopher Felegy
92bf8363ca feature: Add GuildEmote#CreatorID (#1213)
Co-authored-by: Chris Johnston <chris@thejohnstons.net>

commit 23f5abba4822151a6ba9cb5078752b113c4b8ce6
Author: Christopher Felegy <foxbot@protonmail.com>
Date:   Thu Dec 20 17:10:21 2018 -0500

    lint: clean up some long lines

commit 4a8a809db0c2d70c61367c3e1ed4013107cf9f0e
Author: Chris Johnston <chris@thejohnstons.net>
Date:   Sat Dec 15 00:33:05 2018 -0800

    Explain why CreatorId can be null sometimes

commit 9442e4e6358f85177e356f88cd82b73f9f42b1bb
Author: Chris Johnston <chris@thejohnstons.net>
Date:   Fri Dec 14 23:59:01 2018 -0800

    Add the CreatorId property to GuildEmote implementation

commit e0eb94d44cb37c259c27998878330bd68e5706c4
Author: Chris Johnston <chris@thejohnstons.net>
Date:   Fri Dec 14 23:41:54 2018 -0800

    Update the Emoji API model to add User? attribute
2018-12-20 17:10:40 -05:00
Chris Johnston
f4b1a5f25b fix: Improve validation of Bot Tokens (#1206)
* improve bot token validation by trying to decode user id from token

Try to decode the user id from the supplied bot token as a way of validating the token. If this should fail, indicate that the token is invalid.

* Update the tokenutils tests to pass the new validation checks

* Add test case for CheckBotTokenValidity method

* lint: clean up whitespace

* Add check for null or whitespace string, lint whitespace

* fix userid conversion

* Add hint to user to check that token is not an oauth client secret

* Catch exception that can be thrown by GetString

* Refactor token conversion logic into it's own testable method
2018-12-02 13:03:12 -05:00
Chris Johnston
f6413bac59 fix: Update minimum Bot Token length to 58 char (#1204)
* Update the minimum bot token length to 58 char

- Updates the minimum length of a bot token to be 58 characters. An older 58 char bot token was found by Moiph
- Makes this value an internal const instead of a magic number

* update the TokenUtils tests for 58 char min
2018-11-30 07:10:26 -05:00
Still Hsu
a3f5e0b3a7 api: [brk] Move Invites-related Methods from IGuildChannel to INestedChannel (#1172)
* Move invites-related methods from IGuildChannel to INestedChannel

* Add missing implementation

...because I somehow forgot it the first time around
2018-11-29 17:15:11 -05:00
Monica S
7366cd4361 feature: Implement Dispose for types which have disposable data (#1171)
* Initial set of dispose implementations

Not handled yet:
- Discord.Net.Websocket/Entities/SocketGuild
- Discord.Net.Tests

* Refactor DiscordSocketClient init into ctor

This way we remove an IDisposableAnalyzer warning for not disposing
the client when we set the client variable.

* Dispose of clients when disposing sharded client

* Finish implementing IDisposable where appropriate

I opted to use NoWarn in the Tests project as it wasn't really necessary
considering that our tests only run once

* Tweak samples after feedback
2018-11-28 20:18:16 -05:00
Christopher Felegy
5421df14fe feature: add extensions for bulk reactions
this is not api-level bulk reactions (!)
2018-11-27 17:49:30 -05:00
Christopher Felegy
f005af37b4 feature: add Format.Url, Format.EscapeUrl
Format.Url formats a URL into a markdown `[]()` masked URL.

Format.EscapeUrl formats a URL into a Discord `<>` escaped URL.
2018-11-27 17:31:47 -05:00
Nathan Solomon
a64ab6025b Resolve Issue #1188 (Allow Users to specify position when creating a new channel) (#1196)
* Added ability to specify position when creating a channel

* Adjusted categories to include guildproperties and allow specifying position when creating channel categories

* fixed unimplemented methods (for CreateCategoryChannelAsync) and added appropriate documentation
2018-11-27 17:16:32 -05:00
Alex Gravely
8ef5f8120f feature: add Add Guild Member endpoint (#1183)
* Add AddGuildMember Oauth endpoint support

* Concat RoleIds if already exists.

* Use local ids variable.
2018-11-05 18:34:09 -05:00
Still Hsu
7dd2268982 lint: Discord Namespace Clean-up (#1185)
* Remove RpcException

* Move RestConnection to Discord.Net.Rest

* Remove RpcVirtualMessageChannel

* Move REST objects to Discord.Net.Rest

* Fix Discord.Rest namespace
2018-11-05 18:32:30 -05:00
Chris Johnston
8e6e0e9ad2 lint: Remove public setters for MessageApplication, MessageActivity properties (#1182)
This fixes an error that was introduced in d30d12246d (thanks Still for noticing!)

Changes the public property setters of the MessageActivity and MessageApplication entities to be
internal, since they cannot be modified by the user in the API.
2018-10-21 17:27:02 -04:00