Commit Graph

1476 Commits

Author SHA1 Message Date
Finite Reality
0e920da21f Complete Preconditions implementation 2016-08-03 17:21:38 +01:00
Finite Reality
a5393dc937 Rename Permission to Precondition 2016-08-03 16:50:51 +01:00
Finite Reality
023703c996 Add logic to CommandService.Execute to handle basic permissions checks 2016-08-03 16:43:25 +01:00
Finite Reality
757c36ccd1 Rename and move things about 2016-08-03 16:09:58 +01:00
Finite Reality
619e884506 Merge branch 'dev' of https://github.com/RogueException/Discord.Net.git 2016-08-03 15:34:53 +01:00
Finite Reality
eb38bdd437 Fix indentation 2016-08-02 17:54:52 +01:00
Finite Reality
772fd97080 Implement initial command permissions system
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.
2016-08-02 17:29:39 +01:00
RogueException
dcd13e98e9 Cleaned up Disconnect function locking 2016-08-01 22:50:57 -03:00
RogueException
9fc92d016d Don't TrySetException with a null exception 2016-08-01 22:39:36 -03:00
RogueException
cbdcc5f46a Removed Extensions namespace 2016-08-01 21:49:54 -03:00
RogueException
79d5ae7779 Fixed nickname null check, hid internal method 2016-08-01 21:49:54 -03:00
RogueException
c98bd6820e Fixed VoiceChannel.ConnectAsync nullref and race conditions 2016-08-01 05:14:22 -03:00
RogueException
d9b5cd6c98 Merge pull request #167 from DigiTechs/audio
Finish SocketVoiceChannel.ConnectAsync
2016-08-01 03:46:58 -03:00
Christopher F
5049e573b3 Support GET /channels/{id}/pins
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.
2016-07-31 22:06:23 -04:00
Finite Reality
c3dc8cd15a Use async methods and feed exceptions to promise 2016-07-31 18:53:04 +01:00
Finite Reality
1d5ae33e0e Rename promise to make more sense 2016-07-31 15:16:35 +01:00
Finite Reality
7159600d7d Finish SocketVoiceChannel.ConnectAsync 2016-07-31 15:09:27 +01:00
Christopher F
fca0099bc2 SocketSelfUser inherits ISelfUser
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.
2016-07-30 23:01:56 -04:00
RogueException
75b864bfe7 Merge pull request #164 from RogueException/issues/160
Don't load modules that are already loaded
2016-07-30 23:18:58 -03:00
RogueException
8da907a9be Merge pull request #162 from RogueException/issues/146
Added Extension Methods for WebSocket
2016-07-30 22:47:43 -03:00
Christopher F
4c200c94ec Key the ModuleMap based on Type rather than instance 2016-07-30 21:44:14 -04:00
Christopher F
c54f6addd2 Replace IEnumerable with IReadonlyCollection where possible 2016-07-30 21:37:57 -04:00
RogueException
a04cf5201a Cleaned up params implementation 2016-07-30 22:25:17 -03:00
Finite Reality
6732e256fb Clean up a little 2016-07-30 22:25:16 -03:00
Finite Reality
5ce609c323 Fix small typo 2016-07-30 22:25:16 -03:00
Finite Reality
c8fc0ffa33 Add support for 'params' arguments 2016-07-30 22:25:16 -03:00
Christopher F
3c5788bbfc Added GetUsers extensions to WebSocket->Channel
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.
2016-07-30 21:14:20 -04:00
Christopher F
beb2cea232 Added GetChannels extension to WebSocket->IGuild
Adds a sync method to retrieve all cached IGuildChannels on an IGuild.
2016-07-30 21:07:46 -04:00
Christopher F
9348e087b0 Don't load modules that are already loaded
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.
2016-07-30 18:23:12 -04:00
Khionu Terabite
846a1746a2 Added Command.Synopsis for seperation of short and long descriptions, this being intended for long. 2016-07-30 18:09:38 -04:00
Christopher F
e5909c49bd Added extension methods for WebSocket->Channels
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.
2016-07-30 18:05:01 -04:00
RogueException
15dd6016e7 Fixed several CommandParameter nullrefs 2016-07-30 15:13:06 -03:00
RogueException
02d5fc4a8e Exposed CommandParameter's Type 2016-07-30 15:10:50 -03:00
RogueException
c678432b1a Moved reconnect's Disconnect call to its separate task 2016-07-30 04:52:15 -03:00
RogueException
2912107c35 Removed IGuild.CreateInviteAsync 2016-07-30 00:44:26 -03:00
RogueException
7df5fa9371 Merge pull request #157 from RogueException/issues/153
Remove all references to XKCD URLs in Invites
2016-07-30 00:36:11 -03:00
RogueException
3077249705 Fixed parsing errors when the first argument is on a new line 2016-07-30 00:29:25 -03:00
Christopher F
ee7bf028f7 Adjust GuildExtensions per Voltana's feedback
Instead of implicitly soft-casting IGuild to SocketGuild, I added a method to soft-cast IGuild to SocketGuild, and throw an InvalidOp if it came up null for some reason.

GetUsers was changed from an IEnumerable to an IReadOnlyCollection to allow quick ".Count"-ing on the collection.
2016-07-29 23:17:13 -04:00
Christopher F
326686d26a Add Extension Methods for WebSocket->IGuild
For users importing `Discord.WebSocket.Extensions`, there are now non-async extensions for Get(Type)Channel(s) and Get(Current)User(s).

These methods point to the appropriate method or member on SocketGuild.
2016-07-29 23:05:27 -04:00
Christopher F
75802403b5 Remove all references to XKCD URLs in Invites
Resolves #153

This is a breaking change!

With the introduction of Vanity URLs and the shortening of Invite URLs, the API appears to have removed the "xkcdpass" field of the Invite. 

Since this functionality was removed from the Discord API and thus obsolete, it has been removed from the Invite models.
2016-07-29 22:19:09 -04:00
RogueException
c5569a44ea Renamed Unparsed -> Remainder. Fixed non-string remainder parameters. 2016-07-29 23:10:13 -03:00
RogueException
4088ec7fa3 Minor reconnect bugfix, removed unused variables 2016-07-29 21:40:40 -03:00
RogueException
7a36da2b58 Moved REST internal classes 2016-07-29 18:16:57 -03:00
RogueException
260a0153f4 Moved Rpc/WebSocket entities, fixed nullref on RPC message events 2016-07-29 18:11:41 -03:00
RogueException
79f11455b9 Added logging for RPC events 2016-07-29 18:02:39 -03:00
RogueException
6d2a30a739 Fixed typo 2016-07-29 18:00:16 -03:00
RogueException
ab9e70dc67 Added RPC Subscription funcs and Message Events 2016-07-29 17:58:08 -03:00
RogueException
934d080be5 Started adding Rpc events 2016-07-29 17:20:14 -03:00
RogueException
c565bdf55b Reorganized classes into Rpc/Rest/WebSocket namespaces 2016-07-29 17:12:58 -03:00
RogueException
73d4233684 Removed DiscordRpcClient's second log header 2016-07-29 16:46:30 -03:00