After a small discussion with Joe4evr on discord, a way of retrieving the
state of a module appeared to be needed. The new override should provide
enough context to a bot dev to allow them to do what they want.
After our initial discussion on the matter (see #172) this is the system
that we all seem to have agreed on. As a result, I have implemented a
simple system which effectively implements permissions, while being
extensible and tweakable so bot devs can decide what they want to do for
permissions.
As for default 'permissions', I'm not sure what the best approach would be
here; bot devs are likely to implement their own permissions 'levels' and
use those. I think the most we could do for now is add attributes to
require certain users (by id) and certain roles (by id and possibly by
name?) This would probably be the best option for now as it requires less
work from us, nor do we know the *exact* approach bot devs want to take
with permissions.
This commit adds GET /channels/{id}/pins to the ApiClient, and adds GetPinnedMessagesAsync to IMessageChannel. This method is only implemented on the REST entities, and the WebSocket entities do not include an override to retrieve pinned messages from cache.
Resolves#159.
The previous bug was that SocketSelfUser did not inherit from ISelfUser, so DiscordSocketClient.GetCurrentUserAsync was not returning a SocketSelfUser, despite the underlying type being that. This caused ModifyStatusAsync to throw the NotSupportedException that existed on the REST SelfUser.
Cached Channels keep a local cache of the members of that channel. This commit adds a synchronus method to access the cached user stores.
It also fixes a bug where the GetUser extension would return an IGroupUser by soft-casting to IGroupUser, which would always return null. ISocketUser does not share an inheritance with IGroupUser, so I now return IUser instead.
Previously, if a user autoloaded commands more than once, commands that were already in the command map would be readded.
If the module list already contains a module with the same type as the module being loaded, it will not load the new instance of this module.
For users importing `Discord.WebSocket.Extensions`, there are now non-async extensions for GetUser.
These methods point to the appropriate method on the respective SocketgChannel.