Commit Graph

2849 Commits

Author SHA1 Message Date
Still Hsu
bc6009ec72 Implement IMessageChannel#DeleteMessageAsync (#996)
* Implement DeleteMessageAsync

* Refer to MessageHelper instead of duplicating call

* Fix refactor error
2018-05-24 20:08:51 -04:00
Chris Johnston
cee71ef35a Add support for parsing multiple types of quotation marks in commands, Fix #942 (#943)
* Add ability to support different types of quotation marks

* Added normal quotation mark to list of aliases, removed single quote mark

* clean up leftover changes from testing

* change quotation mark parsing to use a map of matching pairs

* remove commented out code

* Fix conventions of the command parser utility functions

* change storage type of alias dictionary to be IReadOnlyDictionary

* revert type of CommandServiceConfig QuotationMarkAliasMap to Dictionary

* minor formatting changes to CommandParser

* remove unnecessary whitespace

* Move aliases outside of CommandInfo class

* copy IReadOnlyDictionary to ImmutableDictionary

* minor syntax changes in CommandServiceConfig

* add newline before namespace for consistency

* newline formatting tweak

* simplification of GetMatch method for CommandParser

* add more quote unicode punctuation pairs

* add check for null value when building ImmutableDictionary

* Move default alias map into a separate source file

* Ensure that the collection passed into command service is not null
2018-05-24 20:07:37 -04:00
Joe4evr
b52af7ae7c Add a dedicated TimeSpan reader so it doesn't suck (#1005)
* Add a dedicated TimeSpan reader so it doesn't suck

* Pass input as lower case
2018-05-24 19:59:32 -04:00
o Acid Chicken (硫硫▒~E▒▒▒~O)
c275e57528 Add support casting System.Drawing.Color to Discord.Color
commit fa3303426766a59e7aa4d67e8b50826cfe7204ec
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sun Apr 29 13:50:56 2018 +0900

    Use built-in symbol

    refs: https://github.com/RogueException/Discord.Net/pull/1043#issuecomment-385223999

commit 27ea82668587960925b73f97c924c9d39ee71f7b
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sun Apr 29 11:29:31 2018 +0900

    Add support casting System.Drawing.Color to Discord.Color

commit 1ab9de24978ff24a018767f80dc95ba19b616988
Merge: f5bb99c7 a4d1e2bc
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sun Apr 29 10:16:46 2018 +0900

    Merge remote-tracking branch 'upstream/dev' into dev

commit f5bb99c77d0fecec21ad769778d17144c047d8b1
Merge: 3be8e40d b8b59d97
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Tue Apr 10 11:07:36 2018 +0900

    Merge remote-tracking branch 'upstream/dev' into dev

commit 3be8e40d3814fe8455af475b8641ee07a8f368d6
Merge: c692306f 9d77a3cd
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sun Jan 7 15:05:31 2018 +0900

    Merge remote-tracking branch 'upstream/dev' into dev

commit c692306fcc1e86ab92dd10683d3719f16c02a249
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sat Nov 11 10:49:00 2017 +0900

    Add target of the internal fields

commit 2d08f9a655b4949c1177f778d0f499047484a537
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sat Nov 11 10:17:42 2017 +0900

    Add some more extension

commit 4f19b835ffe8c64a93a9b4659e60b03ac797760f
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sat Nov 11 01:19:11 2017 +0900

    Add naming rules

commit af756cd9feb630baadbf6025cbb079cd9e1f45cb
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Sat Nov 11 00:35:30 2017 +0900

    Add basic .NET style rules

commit 503ece558b4f07bd8008157d3aeb6a4e7100d349
Author: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Date:   Fri Nov 10 22:36:52 2017 +0900

    Add EditorConfig
2018-05-24 19:52:25 -04:00
Christopher F
5023357a60 codefix #1020: RequestOptions should always be sorted last 2018-05-24 19:36:33 -04:00
Joe4evr
bf5275e071 Add ability to specify parameters on channel creation (#1020)
commit 07bca5b31a3580d55278878eabb56a82973f8c8f
Author: Joe4evr <jii.geugten@gmail.com>
Date:   Fri Apr 6 09:44:50 2018 +0200

    Add ability to specify parameters on channel creation
2018-05-24 19:36:00 -04:00
HelpfulStranger999
0ba8b063ad Makes text parameter of sending messages optional (#1042)
commit 114e5b431b26669bcdaac9f84792a216ad67186f
Author: HelpfulStranger999 <helpfulstranger999@gmail.com>
Date:   Sat Apr 28 19:08:35 2018 -0500

    Fixes lack of default value for tts

commit 1fd8c70c5346ff0c4fdb0093c0fc7fb4b3c8db2c
Author: HelpfulStranger999 <helpfulstranger999@gmail.com>
Date:   Sat Apr 28 15:21:11 2018 -0500

    Makes text parameter of sending messages optional
2018-05-24 19:23:44 -04:00
HelpfulStranger999
79811d0e61 Paginate reactions - solved #1007 (#1022)
* Cleaned up and refactored slightly

* Resolves #971

* Adds support for default avatars and resolves #971

* Amendment

* Final amendment

* Paginating reactions

* Amendments based on feedback

* Further amendment based on review

* Final(?) amendment

* Removes default limit and after user id

* Removes fromUserId; cleans up model creation; replaces function with individual parameters
2018-05-24 18:35:38 -04:00
Quahu
e764dafe08 Add ViewChannel to Voice channel permissions (#1059)
Previously, Voice channels did not have ViewChannel in their "all" permissions
2018-05-13 14:34:40 +01:00
Alex Gravely
32fc2df21b Remove unused field in EmbedFieldBuilder. (#1018) 2018-05-12 20:47:44 -04:00
Finite Reality
39dffe8585 Audit Logs implementation (#1055)
* Copy audit logs impl from old branch and clean up

I suck at using git, so I'm gonna use brute force.

* Remove unnecessary TODOs

Category channels do not provide any new information, and the other
I forgot to remove beforehand

* Add invite update data, clean up after feedback

* Remove TODOs, add WebhookType enum for future use

WebhookType is a future-use type, as currently audit logs are the only
thing which may return it.
2018-05-12 20:46:07 -04:00
Still Hsu
97c893107b Implement GetBanAsync (#1056) 2018-05-06 18:22:49 -04:00
Finite Reality
bb4bb13846 Fix issues with #984, remove extraneous whitespace (#1051)
- Removed unnecessary parameter in SocketVoiceServer

- Moved SocketVoiceServer into Entities/Voice

- Fixed a bug where trying to download the cached guild would throw

- Fixed a potential bug where Discord might not give us a port when
  connecting to voice
2018-05-04 06:42:54 -04:00
Alex Gravely
7cfed7ff67 Fix nullref when passing null to GetShardIdFor. (#1049) 2018-05-03 21:30:13 -04:00
Luke
e775853b1b Expose VoiceServerUpdate events (#984)
* Expose VoiceServerUpdate events

* Amend based on feedback

* Move this out of guild entity

* Fix namespace issue

* Adjust based on feedback #2

* Use cacheable instead

* Change based on feedback
2018-05-03 21:29:51 -04:00
Joe4evr
660fec0cbc Expose the internal entity type readers (#986)
* Expose the internal entity type readers

* Add BestMatch property to TypeReaderResult for easily accessing the parsed object
2018-04-29 11:24:24 -04:00
Alex Gravely
6a7810b3a4 Fix Guild not being populated in SocketWebhookUser (#1044) 2018-04-29 11:18:57 -04:00
Christopher F
217ec34ef0 Add sample bots to the solution (#972)
* Add sample bots to the solution

* Fix missing attributes, show use of preconditions
2018-04-29 11:16:27 -04:00
Still Hsu
73dc884d47 Improve SpotifyGame (#1039)
* Initial commit

* Add TrackUrl

* Rename AlbumArt to AlbumArtUrl for consistency
2018-04-29 11:15:24 -04:00
Still Hsu
3631886d2b Resolves #1024 (#1031)
- Replace 'var _' with simple '_' discard as well.
2018-04-29 11:14:34 -04:00
Allan
9b29c004fa Fixed GetReactionUsersAsync that was not using limit and afterUserId arguments. (#1017) 2018-04-29 11:11:44 -04:00
Still Hsu
7022149536 Fix/Implement various invite-related behaviors (#1023)
* Initial support for invite member count arg

* Fix IDiscordClient#GetInviteAsync behavior

- Previously, the GetInviteAsync method would return null since it couldn't be parsed as a simple RestInvite object. The object should be a RestInviteMetadata instead.

* Fix methods that didn't comply with the interface

* Change with_counts REST behaviour

* Remove unnecessary JSON prop

* Remove AcceptAsync
2018-04-29 11:11:05 -04:00
Joe4evr
6d3010065f Allow setting IgnoreExtraArgs on an individual basis (#998)
* Allow setting IgnoreExtraArgs on an individual basis

* Remove passing in the flag as a separate parameter

* VS plz

* Push the RunMode setting out to its own attribute, because fox wants consistency.

Bonus: Removes the need for that godawful 'RunMode.Default'.

* Revert previous commit

* Fox doesn't like module-wide switches 😒
2018-04-29 11:10:00 -04:00
Still Hsu
a3ce80c1dc Fix Embed.Length behavior (#1012)
- This commit splits up the get statement lines for better analysis.
2018-04-29 11:08:43 -04:00
Acid Chicken (硫酸鶏)
a4d1e2bc14 Fix build fails when built on macOS and Linux (#1026)
* Add EditorConfig

* Add basic .NET style rules

* Add naming rules

* Add some more extension

* Add target of the internal fields

* Fix build fails when built on macOS and Linux

* Use 'Condition' attributes

refs: 6f29dda78b (r181371650)
2018-04-21 14:45:26 -04:00
Still Hsu
510f4745ea Update VoiceRegion model (#1030) 2018-04-21 14:43:00 -04:00
HelpfulStranger999
c618cb3ccd Fixes RetryMode.RetryRatelimit being ignored (#1036) 2018-04-21 14:41:16 -04:00
Joe4evr
b8b59d97ae Forward all embed-related types for non-updated addons (#1021) 2018-04-06 17:28:54 -04:00
Fyers
109f663a9a added UserDefaultAvatar to IUser (#973)
* added UserDefaultAvatar to IUser

* pass ushort as discriminator

* removed unneeded ushort.parse
2018-04-01 14:02:50 -04:00
HelpfulStranger999
c67db88961 Cleaned up and refactored slightly 2018-03-30 15:57:22 -04:00
Christopher F
b918712ad2 Cleanup of #1009 2018-03-30 15:51:28 -04:00
Paulo
6b7c6e9667 Add new overload for AddTypeReader (#1009) 2018-03-30 15:40:43 -04:00
Alex Gravely
2988b38ea8 Resolve mutability issues with EmbedBuilder. (#1010)
* Create new entities on each build call. Added Length property to EmbedBuilder.

* Resolve Length issues per #1012
2018-03-30 15:36:58 -04:00
Joe4evr
d50fc3b4e1 Throw when attempting to modify a message not made by the current user (#992)
* Throw when attempting to modify a message not made by the current user

* Didn't realize the client is passed into the MessageHelper function

* Respond to feedback
2018-03-24 13:12:34 -04:00
Paulo
810f6d610e Fix SocketCategoryChannel properties (#945)
* Update Users property for category channels

* Wrong property being used for Channels property

CategoryId is the category that "owns" this channel. That is actually impossible right now for category channels, so it returns null and get all channels wrongly.

* Resolve permissions for category

* Remove spaces

* Small fix for IChannel.GetUsersAsync
2018-03-24 13:11:55 -04:00
advorange
6d58796f2d Added in an all value for category channels. (#952) 2018-03-24 13:11:43 -04:00
Chris Johnston
88e6244075 Add release version to docs footer, Add doc build instructions (#963)
* Add guide for building the docs

* Add version to the footer of the docs

* fix links for readme

* change formatting of doc build readme

* proper capitalization of DocFX in readme

* Remove code tags around version
2018-03-24 12:28:50 -04:00
Quahu
55299ff14f Prevents NREs when sending/modifying messages (#993) 2018-03-23 19:49:45 -04:00
Christopher F
1905fdec04 Add BanAsync extension to IGuildUser 2018-03-20 16:44:30 -04:00
Christopher F
ac5ecd365d Include the content in payload_json for file uploads
This resolves #987

Previous behavior was that even if `null` was passed for an embed in
UploadFileAsync, the Embed property on UploadFileArgs was still
specified - this meant we were always sending a payload_json.

If a payload_json is specified, it seems like Discord will only read
from the payload_json, and will ignore properties set outside of it.

To prevent unnecessary code duplication, this commit always specifies
parameters in the payload_json, and also will only include the embed if
one was actually specified with real data (not null).
2018-03-19 16:34:21 -04:00
Christopher F
bfaa6fc97a Enforce a maximum value when parsing unix timestamps (#981)
* UnixTimestampConverter should now obey a maximum value

This change prevents an issue where the converter would be unable to
handle obscenely large timestamp values - which are actually quite
common on Discord.

OptionalConverter had to be rewritten to support checking whether or not
an InnerConverter returned an Optional. The perf impacts from this
_shouldn't_ be too bad, as types without a custom parser (which should
be the majority of Optionals in the lib) will bypass the type-check.

* optimizations on OptionalConverter
2018-03-18 16:22:27 -04:00
Christopher F
02c650773d Clean up SpotifyGame PR
- Add a helper under CDN for cover art URLs
It would be bad practice of us to leave CDN urls hardcoded in the
deserializer, would be harder to change down the line should Spotify
ever change their CDN.

I'm not entirely supportive of leaving Spotify's CDN hardcoded in our lib
either, but there's no better alternative.

- Change SpotifyGame#Artists to an IEnumerable<string>
Seems pretty common to prefer IEnumerables in place of Arrays.
2018-03-18 16:18:40 -04:00
Still Hsu
64b9cc7a53 Add Spotify track support (#970)
* Initial Spotify support

* Remove GameAsset#ToEntity

- appId doesn't seem to be necessary, and Spotify Game doesn't return appId either.

* Implement SpotifyGame details

* Implement song Duration prop

* Add album art CDN

* Fix ActivityType

* Remove payload debug

* Add changes according to review

+ Make `ApplicationId` nullable
+ Move ctor after props
2018-03-18 16:06:53 -04:00
Christopher F
b9be6deb4f Move EmbedBuilder+Extensions to Discord.Net.Core
Previously it was implemented under Discord.Net.Rest, which seems
inconsistent and unnecessary.

This also allows Commands docstrings to reference EmbedBuilder, since
Commands only has a dependency on Core.
2018-03-18 15:59:45 -04:00
Christopher F
b38dca7803 All arguments in ReplyAsync should be optional
To reply with just a rich embed, users have to invoke ReplyAsync with
`ReplyAsync("", embed: embed)`, which seems wasteful, when they only
need to specify the embed.
2018-03-18 15:48:34 -04:00
Christopher F
b70ae41285 AddModule(s)Async should be explicit about IServiceProvider
In f19730e4, AddModule(s)Async was changed so that the IServiceProvider
was optional, both at compile time and runtime. This had the side effect
of meaning that there was no longer a compile-time hint that users would
need to pass an IServiceProvider to AddModulesAsync. I assumed this
would not be an issue - users would recognize the runtime exception here
and self correct - but activity in our Discord support channel would
indicate otherwise.

We now require the user to explicitly opt-out of dependency injection -
they are still free to pass null in place of an IServiceProvider if they
do not intend to use one, and the library will handle this at runtime.
2018-03-18 15:35:10 -04:00
Darnell Williams
fc5e70c9dd Attempts to resolve #961 (#962)
* Move REST requests to appropiate class

* Add call to ClientHelper and expose to public API

* Expose shard count request in public api

* Expose method from interface

* Update sharded client to utilize the new method

* Method is already implemented in a base class

* Refactor name to fit pattern for methods returning a `Task`

* Adds missing ConfigureAwait

* Corrects unnecessary whitespace

* Removes unneeded whitespace
2018-03-15 18:49:25 -04:00
Christopher F
f175dde2b3 Clean embed serialization up slightly 2018-03-13 19:16:12 -04:00
Christopher F
e9f9b484b6 Allow attaching embeds alongside a file upload. (#978)
commit a8bafb90cd1c5ea12abaa1aa01d0929833c999a8
Merge: f38dd4c4 7e04285e
Author: WamWooWam <wamwoowam@gmail.com>
Date:   Mon Mar 12 08:05:52 2018 +0000

    Merge branch 'dev' of https://github.com/WamWooWam/Discord.Net into dev

commit f38dd4c42149380f3f7f86c21c86cb76d0f104b7
Author: WamWooWam <wamwoowam@gmail.com>
Date:   Mon Mar 12 08:05:49 2018 +0000

    Cleaned up & fixed code style.

commit 7e04285e5dcc0102c9b958e75155834ca35724b9
Author: Thomas May <wamwoowam@gmail.com>
Date:   Sun Mar 11 14:11:28 2018 +0000

    Revert changes to DefaultRestClient

    Didn't actually need to change this, whoops.

commit 3f5b2c8ef16d356e7b9588c4b36af03162ab7089
Author: WamWooWam <wamwoowam@gmail.com>
Date:   Sat Mar 10 19:30:44 2018 +0000

    Enabled embeds alongside uploaded files.

    God damn Discord is a mess.

Co-authored-by: WamWooWam <wamwoowam@gmail.com>
2018-03-13 18:28:49 -04:00
Christopher F
f9ac190e9a Don't create a service scope in CommandService#ExecuteAsync anymore
IServiceProvider does not support scopes by itself - this is a behavior
introduced by Microsoft's DI container. As such, not all DI containers
may support an IScopeFactory the way that Microsoft's DI is expecting
them to.

This also means that our builtin EmptyServiceProvider does not support
scopes - meaning that users who do not use a DI container can not invoke
commands.
2018-03-13 18:23:42 -04:00