Bruce Marriner
836e78d3d9
Pass struct along with OnEvent event.
2016-04-11 16:56:43 -05:00
Chris Rhodes
4d4f8f7741
Always handle the raw event.
2016-03-21 10:50:56 -07:00
jonas747
d1f25d8561
Changed fmt.Print to log.Print
2016-03-21 17:13:39 +01:00
Bruce Marriner
b1ac010731
Unexported WaitUntilConnected
...
This isn't needed now that the ChannelVoiceJoin waits
for the connection before returning, or returns an error.
2016-03-17 15:57:40 -05:00
Bruce Marriner
513facf391
More cleanup, moving things around..
2016-03-17 15:54:07 -05:00
Bruce Marriner
3ffbbdcc56
Unexport UDPConn as it is no longer needed externally.
2016-03-17 14:39:55 -05:00
Bruce Marriner
397d04b1ff
Fix a couple bugs I just created.
2016-03-17 14:02:19 -05:00
Bruce Marriner
c359bf8395
Cleanup
2016-03-17 13:33:57 -05:00
Bruce Marriner
383a3cf1e0
Delete voice connection from map on error
2016-03-16 22:48:48 -05:00
Bruce Marriner
ee07ed8afe
Only return valid existing voice connections
2016-03-16 22:47:53 -05:00
Bruce Marriner
7ec5304bc9
ChannelVoiceJoin now waits for the connection.
...
You can return to the previous behaviour just by calling
the function as a goroutine. However I feel most uses of it
require the connection to be ready before the next step.
2016-03-15 08:30:05 -05:00
Bruce Marriner
50cc4df965
Some, slightly messy, fixes to get voice -working-.
2016-03-11 23:19:35 -06:00
andrei
5dc0b9f2a1
Add connect timeout, fix ChannelVoiceJoin "leaking" connections
2016-03-08 02:36:00 -08:00
andrei
b48e8c992e
Track voice state changes, expose stuff, add channel changing
2016-03-07 15:41:02 -08:00
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
Chris Rhodes
764371c9ad
👌
2016-01-08 10:31:34 -08:00
Chris Rhodes
be8e0de5c6
Merge remote-tracking branch 'bwmarrin/develop' into stateperf
2016-01-08 10:26:19 -08:00
Chris Rhodes
c842676deb
Don't unmarshall if it won't be used.
2016-01-08 10:24:29 -08:00
Chris Rhodes
0d7b6f7e76
Convert structs and api to use pointers.
2016-01-08 09:37:34 -08:00
Bruce Marriner
d998b1fac2
Normalize name capitalization
2016-01-07 14:15:03 -06:00
Bruce Marriner
301fb980d3
Updated copyright year, cleaned up some comments.
2016-01-07 13:50:44 -06:00
Bruce Marriner
a3ac679d76
Merge branch 'develop' of https://github.com/bwmarrin/Discordgo into develop
2016-01-04 13:14:33 -06:00
Bruce Marriner
1a5c4b7b0d
Moved session close func to discord.go
2016-01-04 13:14:17 -06:00
Bruce Marriner
b329c935ac
Added check to prevent data websocket Listen func from running more than one instance.
2016-01-04 13:06:09 -06:00
Bruce Marriner
666cbeb6a6
Data websocket Heartbeat now uses a chan instead of bool to track state
2016-01-04 12:49:46 -06:00
Chris Rhodes
cd01a34cdb
Handle GUILD_EMOJI_UPDATE and track Emoji in state.
2016-01-03 11:56:46 -08:00
Bruce Marriner
ed1076361e
Changed the order of the heartbeat lock to be a little better.
2016-01-02 22:34:54 -06:00
Bruce Marriner
825144012d
Prevent data websocket heartbeat from running more than once, closes #43
2016-01-02 22:32:02 -06:00
Chris Rhodes
66052d0a9c
Rename methods.
2016-01-02 13:09:20 -08:00
Chris Rhodes
9ba6d5b7c1
Make state tracking optional.
2016-01-02 12:01:03 -08:00
Chris Rhodes
b2ef55ae9c
Cleanup before mailing.
2016-01-01 22:56:32 -08:00
Chris Rhodes
4e23e5fc35
Implement state tracking.
...
Currently maintains a list of Guilds (Members/Channels) and PrivateChannels.
2016-01-01 22:47:19 -08:00
Chris Rhodes
3aaa95d4f9
Tiny cleanup 👌
2015-12-31 12:46:35 -08:00
Chris Rhodes
0e9b8b8714
Small cleanup for initial error handling.
2015-12-31 12:44:02 -08:00
Chris Rhodes
03379f7128
Fix OnReady.
2015-12-31 12:40:36 -08:00
Chris Rhodes
f1fc2f0996
Add GuildBan handling in wsapi. Closes #24 .
...
Also refactor event handling so error logging is unified.
2015-12-31 12:33:46 -08:00
Bruce
5c64020544
Merge pull request #37 from iopred/updatestatus
...
Make update status a little more idiomatic.
2015-12-29 12:58:48 -06:00
Bruce Marriner
6991af8500
Added support for USER_SETTINGS_UPDATE websocket event, closes #11
2015-12-29 12:45:30 -06:00
Chris Rhodes
b5bfa454d0
Do not send game if one is not provided (instead of not sending game.name)
2015-12-29 10:35:00 -08:00
Chris Rhodes
974d5862a4
Make update status a little more idiomatic.
...
This also reduces the line count a smidge.
2015-12-28 19:05:42 -08:00
Bruce Marriner
bb4f63775e
Updated to support new Discord method of sending game playing data, closes #34
2015-12-23 23:51:20 -06:00
Bruce Marriner
0360acbaa0
Added support for USER_UPDATE websocket event, closes #28
2015-12-21 11:24:48 -06:00
Bruce Marriner
a878a5d306
Added comments
2015-12-20 00:12:40 -06:00
Bruce Marriner
332141b083
Updated VoiceChannelJoin func to use struct for data sent over websocket. Also returns an error now.
2015-12-18 20:51:48 -06:00
Bruce Marriner
d59d47967c
Converted to using structs for data websocket handshake. Also using VERSION variable in $browser setting
2015-12-18 15:09:34 -06:00
Bruce Marriner
383b4645da
Finished support for sending presense/game status updates. Closes #18
2015-12-18 13:44:56 -06:00
Bruce Marriner
f402265fd7
OnReady event will be handled if no callback is set by user. README updated.
2015-12-06 19:05:13 -06:00
Bruce Marriner
5c2e3c6866
Added DataReady to data websocket
2015-11-25 19:30:58 -06:00
Bruce Marriner
e384d2d66f
Few notes, also, send 1st data websocket heartbeat immediately.
2015-11-25 08:47:15 -06:00
Bruce Marriner
87f433e2d8
VOICE_STATE_UPDATE should not fall though to Default right now.
2015-11-24 13:42:03 -06:00
Bruce Marriner
35e3966b91
Reworded top comment
2015-11-23 10:16:23 -06:00
Bruce Marriner
abe55ecca7
Some improvements to comments.
2015-11-23 09:45:40 -06:00
Bruce Marriner
3e605c64a6
Moving all structs to structs.go for now.
2015-11-22 14:21:41 -06:00
Bruce Marriner
d9aeb4926d
Experimental voice code added :)
2015-11-18 08:18:46 -06:00
Bruce Marriner
f655167761
Several updates to make library more idiomatic Go
2015-11-16 21:39:39 -06:00
Bruce Marriner
91207ece15
Large additions to REST API and Websocket API.
2015-11-16 13:05:56 -06:00
Bruce Marriner
a3903aaa50
Fixes to GuildRole events
2015-11-14 21:23:01 -06:00
Bruce Marriner
05ff822438
Stop trying to fight Discord's Int's as Strings and just use strings.
2015-11-14 21:02:35 -06:00
Bruce Marriner
3794c1a31e
Added Guild Role Update handler
2015-11-13 19:38:35 -06:00
Bruce Marriner
f885ce38d2
Added support for GUILD_UPDATE event
2015-11-13 09:48:56 -06:00
Bruce Marriner
3d9e980619
Several bug fixes causing json unmarshal errors.
2015-11-13 09:36:11 -06:00
Bruce Marriner
074d1bcdae
Huge update to Websocket support.
...
Changed "Server" to "Guild" to remain consistant with Discords
API naming.
2015-11-12 23:25:48 -06:00
Bruce Marriner
e8b77083df
Inital implementation for callback funcs handling Websocket events
2015-11-12 09:59:37 -06:00
Bruce Marriner
2c3ca777f9
Clean up, notes
2015-11-09 14:22:36 -06:00
Bruce Marriner
fff4fa20e9
Clean up
2015-11-08 21:57:49 -06:00
Bruce Marriner
e6789fde74
Inital add of Websockets
2015-11-08 21:42:16 -06:00
Bruce Marriner
adac11495a
Inital addition of Websocket handling. Lots of moving things around.
2015-11-08 19:26:46 -06:00