Commit graph

102 commits

Author SHA1 Message Date
andrei
1fc0e2053b Add support for multiple voice connections
With the upcoming API changes, Discord will be allowing bot users to be
onnected to more than one voice channel at a time. This commit is a
first stab at implementing that functionality in discordgo.

Voice works pretty good right now, ideally the next step is to cleanup
some of the channel-spam and weird blocking-spots.
2016-03-05 01:05:18 -08:00
Chris Rhodes
abc0e5b095 Work around a Discord server issue. 2016-02-22 00:11:39 -08:00
Bruce Marriner
94f0aacc0a websocket heartbeat is now simplier. Closes #121 2016-02-20 15:19:55 -06:00
Chris Rhodes
457b03f66e Fix deadlock because I'm dumb. 2016-02-19 23:00:41 -08:00
Chris Rhodes
79247272ff Handler updates, no backwards incompatible API changes.
AddHandler now returns a func that can remove the handler.
The handlers map is now guarded by its own mutex.
Moved eventMap to events.go for readability.
Improved documentation.
2016-02-19 22:28:21 -08:00
Bruce Marriner
a5130cff51 Added large_threshold to connection and set to 250, closes #41 2016-02-18 22:18:03 -06:00
Bruce
296a118712 Merge pull request #113 from iopred/develop
Clean up mutexes around s.handlers so they exist only in discord.go
2016-02-18 21:48:31 -06:00
Bruce Marriner
eec0faa7b3 Handle VOICE_SERVER_UPDATE better, closes #115 2016-02-18 21:42:23 -06:00
Bruce Marriner
b38745945b Added support for leaving voice channel, closes #118 2016-02-18 21:24:14 -06:00
Bruce Marriner
60149f70bb Allow calling ChannelVoiceJoin even after connected to voice, closes 2016-02-18 02:24:29 -06:00
Chris Rhodes
d22b7ffc90 Clean up mutexes around s.handlers so they exist only in discord.go 2016-02-17 23:17:31 -08:00
Chris Rhodes
b083ce00c7 Un-expose handlers. Clean up Session struct. 2016-02-14 21:58:29 -08:00
Chris Rhodes
6fa99712ef Finish converting large switch statement into a map of functions. 2016-02-14 18:48:37 -08:00
Chris Rhodes
8ffaa85b0b Thread safety and more events. 2016-02-14 13:41:56 -08:00
Chris Rhodes
fb6ae92555 Add basic support for mapped event handlers. 2016-02-14 13:17:20 -08:00
Chris Rhodes
7d112b562e Mirror the Voice guard. 2016-02-08 10:08:24 -08:00
Chris Rhodes
b2c76de22e Merge remote-tracking branch 'bwmarrin/develop' into voice 2016-02-08 10:06:17 -08:00
Chris Rhodes
7858f999b1 Handle nil errors and default handler properly. 2016-02-08 10:03:32 -08:00
Bruce Marriner
348d9482d0 Removed unneeded blank line :) 2016-02-08 10:26:44 -06:00
Bruce Marriner
1a0e4c05fa Call user callback for VOICE_STATE_UPDATE events, closes #101 2016-02-08 10:18:08 -06:00
Chris Rhodes
40b969d7c3 VoiceServerUpdate and VoiceStateUpdate 2016-02-08 08:05:08 -08:00
Bruce Marriner
edc09778a7 Linting. 2016-01-28 08:36:09 -06:00
Bruce Marriner
546cd85303 error strings should not end with punctuation. 2016-01-27 23:38:38 -06:00
Bruce Marriner
6bb417af7a Removed unreachable (and unneeded) code x3! 2016-01-27 23:37:46 -06:00
Bruce Marriner
5ae93327e3 Removed unreachable (and unneeded) code. 2016-01-27 23:36:34 -06:00
Bruce Marriner
457d27b35e Removed unreachable (and unneeded) code. 2016-01-27 23:35:42 -06:00
Chris Rhodes
fd32614a63 Make compression optional, clean up some comments and unused fields. 2016-01-24 09:49:41 -08:00
Chris Rhodes
5a3740df0c 💩 2016-01-23 21:12:57 -08:00
Chris Rhodes
a08dde4262 Support zlib compression. 2016-01-23 21:09:30 -08:00
Chris Rhodes
25a1b2ea48 Close. 2016-01-23 20:24:52 -08:00
Chris Rhodes
e94e14e9d2 Support ShouldReconnectOnError with exponential backoff up to 10 minutes. 2016-01-21 14:15:24 -08:00
Chris Rhodes
ddddfa3644 Prevent heartbeat from sending on nil websocket. 2016-01-21 11:15:44 -08:00
Chris Rhodes
d6d6c749ea Prevent listen from reading from nulled out web socket. 2016-01-21 11:11:18 -08:00
Chris Rhodes
8b39278c3e Get rid of Listen. 2016-01-21 10:58:13 -08:00
Chris Rhodes
e8d8f03214 Clean up ready timing, fix potential race with starting heartbeats. 2016-01-21 09:33:05 -08:00
Chris Rhodes
c4869d7a43 Remove handshake. 2016-01-21 09:19:20 -08:00
Chris Rhodes
2a9538e9f1 I must stop doing last minute changes. 2016-01-20 23:01:20 -08:00
Chris Rhodes
7a9b9428ee Re-add old todo. 2016-01-20 22:52:42 -08:00
Chris Rhodes
cd55a59ff9 Refactor open/close logic. Support OnConnect and OnDisconnect. 2016-01-20 22:47:34 -08:00
Chris Rhodes
6b73b588ba Message tracking. 2016-01-16 01:13:40 -08:00
Chris Rhodes
0f38b22ca1 Message state tracking. 2016-01-16 00:20:41 -08:00
Chris Rhodes
fce9a7dedc Make unmarshal methods not on the struct, that was stupid. 2016-01-11 17:39:25 -08:00
Chris Rhodes
3acc68d3ef Fix wsapi 2016-01-11 17:22:37 -08:00
Chris Rhodes
f15b389ac8 Return a consistent JSON Unmarshal error. 2016-01-11 16:37:17 -08:00
Bruce Marriner
6274ab9053 Hackish fix so we don't try to close nil or closed channels. 2016-01-11 14:05:22 -06:00
Bruce Marriner
093d3be770 More improvements to voice support 2016-01-10 18:01:05 -06:00
Bruce Marriner
9583ef4e19 Return immediately if err getting gateway. 2016-01-10 14:46:44 -06:00
Bruce Marriner
1b3817c7e1 First re-write of voice support. BREAKING CHANGE. 2016-01-09 20:56:30 -06:00
Chris Rhodes
5544372242 I think I got it right this time ;) 2016-01-08 11:28:44 -08:00
Chris Rhodes
f05f79e24d Fix subtle difference between events with state tracking and not, when the handler is null. 2016-01-08 10:39:24 -08:00