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.
* 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
commit a8bafb90cd
Merge: f38dd4c47e04285e
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 f38dd4c421
Author: WamWooWam <wamwoowam@gmail.com>
Date: Mon Mar 12 08:05:49 2018 +0000
Cleaned up & fixed code style.
commit 7e04285e5d
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 3f5b2c8ef1
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>
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.
This prevents an issue where no clients could be constructed.
In 2fd4f56, the case for user tokens was removed from GetPrefixedToken,
which means that the default value for TokenType would now fallthrough
to the default case, which throws an error.
* Set usage of TokenType.User as an error rather than a warning.
* Remove commented sections and #pragma's
Additionally, changes use of ReadMessages to ViewChannel since that Obsolete was also suppressed by the pragma
If one is not passed, they will default to an EmptyServiceProvider
This resolves issues where since the merging of OnModuleBuilding, users
were effectively forced to use the DI pattern, where before they were
not.
While this isn't necessarily a bad idea, we shouldn't just change this
behavior for no reason (though I assume making the IServiceProvider
argument required was a mistake)
* Add tests for more Permissions code coverage
* Add guild tests
* Add more in-depth covering of permissions methods
* Add tests for OverwritePermissions
* Remove unknown ItemGroup tag from csproj
* Add missing Fact attributes, separate class so that it is not dependant on main test fixture
* Separate out GuildPermissions and ChannelPermissions tests from main partial Tests class because they do not need to have access to the main test fixture
HasFlag was checking if any of the flags were set, not the ones
specified, and ResolveChannel was still treating the ChannelPermission
enum as before it was changed to a bitflag.
This fixes an issue where custom ModuleBases that contained a generic
parameter would be loaded as a module - only to fail when trying to be
built.
Realistically, ModuleBases _should_ be abstract - but it was still a bug
that we allowed them to be included as a module.
commit 5b047bf02b
Author: Joe4evr <jii.geugten@gmail.com>
Date: Fri Feb 2 22:22:00 2018 +0100
[feature/OnModuleAdded] Quickstart fixes (#946)
* Quickstart: fix minor derp
* Other overdue fixes
commit bd3e9eee94
Author: Christopher F <computerizedtaco@gmail.com>
Date: Sat Jan 27 16:51:18 2018 -0500
Resort usings in ModuleBase
commit 8042767579
Author: Christopher F <computerizedtaco@gmail.com>
Date: Sat Jan 27 16:41:39 2018 -0500
Clean up removed owned IServiceProvider
commit 30066cb102
Author: Christopher F <computerizedtaco@gmail.com>
Date: Sat Jan 27 16:37:22 2018 -0500
Remove redundant try-catch around OnModuleBuilding invocation
If this exception is going to be rethrown, there's no reason to include
a try-catch.
commit 60c7c31d44
Author: Christopher F <computerizedtaco@gmail.com>
Date: Sat Jan 27 16:36:27 2018 -0500
Include the ModuleBuilder in OnModuleBuilding
This allows modules hooking into OnModuleBuilding method to mutate
theirselves at runtime.
commit b6a9ff5786
Author: Joe4evr <jii.geugten@gmail.com>
Date: Mon Jan 22 13:17:14 2018 +0100
#DERP
commit f623d19c68
Author: Joe4evr <jii.geugten@gmail.com>
Date: Mon Jan 22 13:15:31 2018 +0100
Resolution for #937 because it's literally 4 lines of code
commit 8272c9675b
Author: Joe4evr <jii.geugten@gmail.com>
Date: Mon Jan 22 11:39:28 2018 +0100
Re-adjust quickstart
commit e30b907135
Author: Joe4evr <jii.geugten@gmail.com>
Date: Mon Jan 22 11:35:08 2018 +0100
Undo experimental changes, request IServiceProvider instance everywhere instead
commit ad7e0a46c8
Author: Joe4evr <jii.geugten@gmail.com>
Date: Fri Jan 19 03:40:27 2018 +0100
Fix quickstart leftover from previous draft
commit e3349ef3d4
Author: Joe4evr <jii.geugten@gmail.com>
Date: Fri Jan 19 03:33:46 2018 +0100
Doc comment on items
commit 81bd9111fa
Author: Joe4evr <jii.geugten@gmail.com>
Date: Fri Jan 19 03:16:44 2018 +0100
Add comment about the ServiceProviderFactory in the quickstart
commit 72b5e6c8a1
Author: Joe4evr <jii.geugten@gmail.com>
Date: Fri Jan 19 03:10:40 2018 +0100
Remove superfluous comments, provide simpler alternative for setting the ServiceProvider.
commit 74b17b0e04
Author: Joe4evr <jii.geugten@gmail.com>
Date: Tue Jan 16 18:06:28 2018 +0100
Experimental change for feedback
commit 7b100e99bb
Author: Joe4evr <jii.geugten@gmail.com>
Date: Mon Jan 15 23:34:06 2018 +0100
* Make the service provider parameters required
* Adjust quickstart guide to reflect changes
commit 7f1b792946
Author: Joe4evr <jii.geugten@gmail.com>
Date: Mon Jan 15 20:04:37 2018 +0100
I..... missed one.
commit 031b289d80
Author: Joe4evr <jii.geugten@gmail.com>
Date: Mon Jan 15 20:02:20 2018 +0100
Rename method to more intuitive 'OnModuleBuilding'
commit 9a166ef1d0
Author: Joe4evr <jii.geugten@gmail.com>
Date: Mon Jan 15 19:09:10 2018 +0100
Add callback method for when a module class has been added to the CommandService.
This resolves#938 and #883
Note: This fix is not 'verified' in production (I waited over a week for
another full Discord outage and never encountered one), but I do have it
on record from b1nzy that Discord may send an OP9 with `{"d": true}`
during outages, so this would appear to be the proper fix.
The removed code seems to have been leftover from when ConnectionManager
was rewritten and never finished.
This resolves#824.
Discord seems to have inconsistencies where a role can be deleted, but
there will still be a few users who still have it in their `role_ids`. I
was able to find this bug appearing in 11 members of a 10,000 member
guild, so it would make sense that this is relatively rare, and it's why
we hadn't noticed it previously.
Since our permission resolution code is implementation agnostic, it
operates on the user's RoleIds collection, which is what Discord sends
us directly, and is not vaidated against the member's guild.
In our permission resolution code, we make the assumption that Discord
will always be telling us the truth with regard to a member's
`role_ids`. This PR changes the behavior of permissions resolution to
instead verify that the guild was able to return a role before
attempting to resolve its permissions.
This resolves#931
As part of this change, StreamingType has been refactored to realign
with how Discord seems to define the 'type' field on activities now.
StreamType is renamed to ActivityType, and the following properties have
been changed:
- NotStreaming -> Playing
- Twitch -> Streaming
Additionally, the StreamType property/parameter has been removed from
StreamingGame, and moved up a scope to Game.
Normal Games may now set their type, to line up with changes in
Discord's official clients.
* Apply consistency to attributes in the commands extension
This resolves#527.
Not sure if I missed any, putting this up for review.
* Allow preconditions to be used multiple times (for use with groups)
This resolves#762.
This change adds an 'html' variant to the EmbedType enum.
This change also adds an 'Unknown' variant to the EmbedType enum (at
position -1); this will be used in a later commit to future-proof the
EmbedType enum from any further variants Discord may add.
Resolves#918.
For some reason (that i'm sure will bite me in the ass later), we
configured Json.Net with a time format that forced UTC - even when the
API appends a timezone to the timestamp. Removing the custom time format
seems to resolve this issue.
This change resolves#916
Discord requires the {"type": 0} payload for all non-streaming
activities. This change fixes a bug where name-only games would fail to
include this payload, causing the presence change to be discarded by
Discord.
This resolves#742.
Common cases for IGuild being null on access are DMs (since they do not
belong to a guild) - this change resolves null guilds to shard zero,
where DMs are also received.
* Fix#854 Added ViewChannel enum and property to channel permissions
* replaced usages of ChannelPermission#ReadMessages with ViewChannel
* rename parameter of ChannelPermissions constructor
* made OverwritePermissions#ReadMessages obsolete, use ViewChannel instead
* Fix#854 Added ViewChannel enum and property to channel permissions
replaced usages of ChannelPermission#ReadMessages with ViewChannel
rename parameter of ChannelPermissions constructor
made OverwritePermissions#ReadMessages obsolete, use ViewChannel instead
* renamed readMessages parameter in ChannelPermissions constructor and Modify
* fixed channel permission tests to use ChannelPermission enum instead of GuildPermission enum
* replaced usages of readmessages in channel permission tests
* resolve build warnings for permission tests
commit a85c5814a7
Author: Christopher F <computerizedtaco@gmail.com>
Date: Sat Jan 6 22:25:48 2018 -0500
Code cleanup
commit 4b243fd3dd
Author: Christopher F <computerizedtaco@gmail.com>
Date: Sat Jan 6 22:08:28 2018 -0500
Add support for channel categories (#907)
commit 41ed9106f2
Author: mrspits4ever <spits.lucas@gmail.com>
Date: Thu Dec 14 20:02:57 2017 +0100
removed mentioning support for RestCategoryChannel, added channels property to SocketCategoryChannel
commit 71142c3108
Merge: 4589d731678a7238
Author: mrspits4ever <spits.lucas@gmail.com>
Date: Wed Dec 13 21:17:53 2017 +0100
Merge branch 'dev' of https://github.com/RogueException/Discord.Net into feature/channel-categories
commit 4589d73187
Author: mrspits4ever <spits.lucas@gmail.com>
Date: Wed Dec 13 21:17:46 2017 +0100
adressed requested changes
commit d59b038efa
Author: pegasy <pegasy@users.noreply.github.com>
Date: Mon Sep 25 18:53:23 2017 +0200
Renamed classes / properties / methods to use CategoryChannel instead of ChannelCategory to be consistant with how text / voice channels are named.
commit 5c4777dc8c
Author: pegasy <pegasy@users.noreply.github.com>
Date: Sun Sep 24 19:08:25 2017 +0200
removed Guild from class name for ChannelCategory
Renamed all properties to use Category instead of Parent
Throw exception on GetUsers / GetInvites etc for categories
commit e18bd8c799
Author: pegasy <pegasy@users.noreply.github.com>
Date: Sun Sep 24 15:49:51 2017 +0200
Add support for channel categories (as its own channel type)
* Added workaround for UserHelper#ModifyAsync that accepts null values as a way to reset user nicknames
* Update comments
* Update comment to use see tag
* Add Webhook API models, REST implementation, and Socket bridges.
* Remove token overrides from REST.
Leaving that as a Webhook package only feature.
* Add Webhook API models, REST implementation, and Socket bridges.
* Remove token overrides from REST.
Leaving that as a Webhook package only feature.
* Webhook core implementation.
* Webhook REST implementation.
* Webhook client implementation.
* Add channel bucket id.
* Added support for animated emoji
This was such a useful feature Discord, I'm glad you added this instead
of fixing bugs.
* Fix bugs in emote parser
* Added unit tests for emotes
* Add API-level support for Rich Presences
* Add library-level support for Game presences
* Add model conversions for outgoing+incoming rich presences
* Refactored Game into Activities
* Integrated Activities with user entities
rebase hell from 5f3cb947a9
* Fix JSON converters for Activities
* Finish rebase, activity should be set on BaseSocketClient
* Use ApplicationId to define a rich presence
* Added SetActivityAsync to Base and Sharded Socket clients
* Remove public parameterless Game constructor
* Remove GameAssets, refactored to GameAsset
* Hide constructors for types that should be read-only
* Revert changes to Discord.Net.sln
got damned visual studio caching
* Refactor GameParty to use dedicated current/capacity values
Per feedback from @khionu