Commit Graph

102 Commits

Author SHA1 Message Date
Hawx
bbbac85c46 Update Dependencies and support NS2.0 builds (#1046)
* Update deps, fix test warnings.

* Support ns2.0

* Fix typo

* Remove ns1.1 support

* Net.Http and Net.Websockets.Client are not needed in ns2.0

* Move to net46 per volt

* Remove ns1.3 constants
2018-05-25 08:14:28 -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
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
Still Hsu
3631886d2b Resolves #1024 (#1031)
- Replace 'var _' with simple '_' discard as well.
2018-04-29 11:14:34 -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
2fd4f5670e Remove support for TokenType.User (#958)
* 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
2018-03-12 13:59:22 -04:00
Christopher F
73ac9d7886 Remove incomplete reconnect handler for certain session invalidations
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.
2018-01-27 16:08:01 -05:00
Christopher F
a384ce02ab Support listening/watching activity types
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.
2018-01-13 23:29:59 -05:00
Christopher F
fdd2c80d2b Fix outgoing activity sending (#916)
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.
2018-01-06 23:20:21 -05:00
Christopher F
34b4e5a6d2 Refactor Games, support reading Rich Presences (#877)
* 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 5f3cb947a92f4fd01cc4df47ca548180036b47f3

* 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
2017-12-23 14:58:35 -05:00
Christopher F
347c5a0d39 Disable obsolete warnings in files that reference TokenType.User 2017-09-29 17:37:07 -04:00
Alex Gravely
9b7afec4cc Add BaseSocketClient object. (#773)
* Add BaseDiscordClient. Add various missing RequestOptions args.

DiscordSocketClient and DiscordShardedClient's shared members now exist in this abstract class.

* Add ShardReady event.

* Style consistency. Remove extraneous overloads.

Remove extraneous overloads.

* Add BaseSocketClient#DownloadUsersAsync().

Style cleanups.

* Add ShardLatencyUpdated event.

Style cleanup.

* Hook LatencyUpdated for ShardedClient.

* Begone whitespace.

* I'm good at this, I swear. >_>

* Add back DiscordShardedClient.UserPresenceUpdated

* Add ObsoleteAttribute

* Removing the UserPresenceUpdated event.
2017-09-27 18:20:31 -04:00
RogueException
f997089174 Try to pull DM channels from cache on CHANNEL_CREATE 2017-08-17 02:54:19 -03:00
RogueException
14dfc48df3 Style cleanup 2017-06-29 19:44:32 -03:00
Christopher F
5f04e2beba Cache outgoing presence data if disconnected (#705)
This resolves #702
2017-06-23 11:29:45 -03:00
AntiTcb
7db38f32bb Attach/Remove DMChannel to SocketGlobalUser.DMChannel property 2017-05-16 20:04:25 -04:00
Sindre Langhus
82a413ace6 Fix for empty user objects after GUILD_MEMBER_REMOVE (#641)
* Made GetOrCreateUser always call AddRef and added check to PRESENCE_UPDATE to avoid readding users who have been removed from guilds

* Removed AddRef as per dev guild discussion
2017-05-04 13:16:33 -03:00
Sindre Langhus
90ac9027cf Replace Where+FirstOrDefault with FirstOrDefault in SocketClient (#636)
* Replace Where.FirstOrDefault with FirstOrDefault

* Replace Where+FirstOrDefault in ClientHelper
2017-04-30 21:29:12 -03:00
Christopher F
be6abe1161 Throw when the client isn't logged in instead of connected
The previous commit prevents any connections, since the initial presence update is sent while the client is still in the 'connecting' state, rather than the 'connected' state.

This resolves the original issue by preventing a nullref, and the more recent issue by only throwing a detailed exception when the CurrentUser is null (the client isn't logged in).
2017-04-24 21:53:41 -04:00
Christopher F
f759f942f8 Throw a preemptive exception when sending presence data before connect
This prevents a later, less detailed nullref, when attempting to set the CurrentUser's presence data.

This also removes a redundant CurrentUser assignment in the SetGameAsync method, since this will be set later on in the SendStatusAsync method.
2017-04-24 20:34:18 -04:00
Christopher F
431b7fbd9f Visual Studio C#7 suggestions 2017-04-23 15:23:06 -04:00
RogueException
6192228378 Raise GuildMembersDownloaded for non-large guilds 2017-04-06 00:03:34 -03:00
RogueException
eed0598f99 Destroy audio stream when a user disconnects 2017-04-04 00:59:16 -03:00
RogueException
b1caec5f59 Add better support for invisible users 2017-04-02 15:08:28 -03:00
RogueException
58d2de2578 Added config for handler timeout duration 2017-04-02 14:49:04 -03:00
RogueException
f0202e4d4e Improved warnings for unknown entities 2017-04-02 14:38:05 -03:00
RogueException
bc2e0a19af Fixed non-guild presence updates 2017-04-01 16:44:03 -03:00
RogueException
fd72583a75 Move guild presence updates to GuildMemberUpdated. Filter duplicate UserUpdated events. 2017-04-01 15:05:51 -03:00
RogueException
27d6f4159d Lowered latency updates to debug level 2017-04-01 11:42:19 -03:00
RogueException
158ce0f922 Started adding IAudioClient incoming stream creation/destruction events 2017-03-31 03:59:12 -03:00
RogueException
5e94b97024 Added RequestOptions to RestClient methods. Added guild summary paging. 2017-03-31 03:01:49 -03:00
RogueException
13d488f43b Added slow/deadlocked event handler detection 2017-03-31 00:35:20 -03:00
RogueException
bf0be82d15 Added IWebhookUser and MessageSource 2017-03-30 23:29:30 -03:00
RogueException
3a45e9ec87 Support InvalidSession(true) 2017-03-20 23:49:17 -03:00
RogueException
254c83ecff Started adding audio receive 2017-03-15 23:40:25 -03:00
RogueException
1d5b7a2b01 Removed Unknown status 2017-03-15 23:40:25 -03:00
RogueException
3bd920ce66 Merged UserPresenceUpdated into UserUpdated 2017-03-15 23:40:25 -03:00
RogueException
92028f59e9 Removed SocketClient's explicit ConnectionState 2017-03-13 22:25:38 -03:00
RogueException
900b9b082e Removed persistant guild list for user downloads 2017-03-13 22:17:35 -03:00
RogueException
cab41851ba Prevent duplicate GuildUnavailables 2017-03-13 22:14:30 -03:00
RogueException
7e7df27024 Ready event waits until guilds are downloaded 2017-03-13 22:14:30 -03:00
Christopher F
bb78c50b6f Fix ConnectionState on DiscordSocketClient
This should resolve a plethora of relates issues, including user downloading not working (#542), possibly #531
2017-03-09 19:25:43 -05:00
RogueException
8c75e0d581 Fixed a couple audio bugs 2017-03-02 06:12:14 -04:00
Christopher F
5e1d84d918 Merge pull request #395 from LassieME/issue/359
Conflicts:
	src/Discord.Net.WebSocket/DiscordSocketClient.cs
2017-03-01 17:34:39 -05:00
RogueException
06dcac6a9f Fixed audio and a few ConnectionManager issues 2017-02-25 16:07:22 -04:00
RogueException
3190d7e26d Moved (re)connection handling to ConnectionManager 2017-02-25 16:07:22 -04:00
RogueException
8630185ac9 Started Discord.Net.Relay 2017-02-25 16:07:22 -04:00
RogueException
d321ad3e5c Moved Frame models, added default providers 2017-02-25 16:07:22 -04:00
Sindre G. Langhus
ab60f63511 Changes HasValue in Cachable to constructor argument 2017-02-21 22:11:48 +09:00
RogueException
e0a0d2100d Reduced missed heartbeat aggressiveness 2017-02-11 01:49:28 -04:00