Bruce
06b35cfe24
Linting.
2017-09-03 20:01:46 +00:00
Jonas is my name
308d058bf1
Fix presence update after breaking API change ( #427 )
2017-08-17 06:55:02 -07:00
Necroforger
013faa1da4
Hardcoded reactions ratelimit ( #398 )
...
* add custom ratelimits
* check for nil ratelimiter
* Don't expose custom ratelimits to Session
* attempt to fix race conditions
* use defer instead
* Slightly improved ratelimiter
You shouldn't need to change the ratelimiters ratelimits while its
running so I removed the functions SetCustomRatelimit and
RemoveCustomRatelimit.
2017-07-29 07:53:02 -07:00
legolord208
7bb0965a6f
Updated to v6 ( fixes #408 ) ( #410 )
...
* Updated to v6
* Unified websocket and REST version
2017-07-22 06:17:39 -07:00
Erik McClure
71ede90b56
Fix #406 : reconnect() can be called while still connected ( #407 )
2017-07-18 18:21:45 -07:00
Erik McClure
bb4b96e26d
Add heartbeat ACK response and error handling ( #396 )
...
* Add heartbeat ACK response and error handling
- Error when sending a heartbeat now triggers a reconnection
- Op7 now triggers a reconnection
- Session now tracks the last heartbeat ACK that was recieved. If the
last ACK is more than FailedHeartbeatAcks*heartbeatinterval in the past,
this is treated as a dead connection and a reconnection is forced.
* Address @iopred comments
2017-06-27 20:52:59 -07:00
legolord208
aa3973f956
Made error constants ( Fixed #315 ) ( #377 )
2017-05-08 06:48:19 -07:00
Lukas
edd6e169fa
Track voice-channel movements ( #317 )
2017-02-11 22:18:19 -08:00
jonas747
b07d1c4621
Fix leaking tickers ( #314 )
2017-01-23 12:13:59 -08:00
jonas747
bdb31f245d
Fix all found race conditions, and dont send on nil channel ( #307 )
2017-01-10 20:01:47 -08:00
jonas747
2d50fc197f
Fix racey heartbeat sequence ( #303 )
...
* Fix racey heartbeat sequence
* Change all sequence fields to int64
2016-12-28 11:59:02 -08:00
Kristian Klausen
b377944b97
Switch to V5 gateway ( #300 )
...
This switch the gateway to V5, and change the heartbeat logic to
get the heartbeat_interval from the new Hello opcode instant of
READY/RESUME event.
See: https://github.com/hammerandchisel/discord-api-docs/issues/18
Fix : #220
2016-12-25 16:22:14 -08:00
Bruce Marriner
9e777a083b
Linting.
2016-12-11 12:45:34 -06:00
Chris Rhodes
36601253a4
Remove use of reflect.
...
This introduces gogenerate'ed EventHandlers from the files in events.go
This also adds support for AddHandlerOnce.
2016-12-03 23:31:07 -08:00
Chris Rhodes
c352d7016c
Clean up ordering of internal handlers. ( #285 )
2016-11-12 11:50:06 -08:00
Chris Rhodes
3e7c0435bc
Reduce severity of wsConn close error logging.
2016-11-05 00:16:15 -07:00
Chris Rhodes
c6ee0d2dd5
Clean up state access. ( #261 )
...
Clean up state access.
2016-09-27 22:45:12 -07:00
Chris Rhodes
b71136ac14
Merge pull request #259 from b1naryth1ef/bugfix/voice-state-update-api-usage
...
Remove API call in onVoiceStateUpdate
2016-09-27 22:35:56 -07:00
Chris Rhodes
2e2e02fc11
Support a very light state in all cases to support b1nzy's upcoming PR ( #260 )
...
Support a very light state in all cases to support b1nzy's upcoming PR
2016-09-27 22:09:44 -07:00
jonas747
1dcdf130fd
Fix Another typo
2016-09-28 07:00:11 +02:00
jonas747
1ecb7458e9
Fix typos
2016-09-28 06:31:39 +02:00
andrei
1edd3b6484
Remove API call in onVoiceStateUpdate
2016-09-27 17:39:14 -07:00
jonas747
9c7c9d3fd2
Added RequestGuildMembers to request guild members from the gateway
2016-09-25 21:29:59 +02:00
Bruce Marriner
bbce2612b0
simi-properly close websockets and simplify voice reconnect
2016-07-06 20:31:47 -05:00
Bruce Marriner
ad91025f59
Don't delete VoiceConnections
...
But, don't add a VoiceConnection either if we don't successfully
connect.
2016-07-05 20:51:52 -05:00
Bruce Marriner
fb663ac348
Linting
2016-06-17 15:44:01 -05:00
Bruce Marriner
11f11de41c
Protect writes to DataReady with mutex lock
2016-06-17 14:23:19 -05:00
Bruce Marriner
face6df4b6
Do not call session onEvent as goroutine
...
This is a stability improvement but may have a slight performance
impact. This change will be reviewed again later. Doing this solves a
data race issue with the Sequence number that must be tracked for
gateway resume and heartbeats. Event specific handlers are now called
as a goroutine though.
2016-06-17 12:24:32 -05:00
Bruce Marriner
e451cb36c3
Clear SessionID when reconnecting voice
...
Also added some more logging..
2016-06-17 10:24:15 -05:00
Bruce Marriner
9dc51d1c49
Only Shard when ShardCount > 1
...
Also cleaned up identify sending so there's now a function that handles
it instead of duplicate code. Renamed handshake* structs to identify*
structs to make naming match up.
2016-06-14 13:45:38 -05:00
Bruce Marriner
d03b3eedfa
Merge branch 'feature/sharding' of https://github.com/b1naryth1ef/discordgo into b1naryth1ef-feature/sharding
2016-06-14 11:45:59 -05:00
Bruce Marriner
c32de41481
Force Voice reconnect on gateway reconnects
...
Also did a bit of clean up.
2016-06-14 10:55:20 -05:00
andrei
835a23a89d
Implement guild sharding
2016-06-13 15:34:40 -07:00
Bruce Marriner
af201919a0
Move logging
2016-05-28 15:10:55 -05:00
Bruce Marriner
ff0a39b9b5
Clean up.
2016-05-28 14:32:22 -05:00
Bruce Marriner
754d64d339
Initial code to support voice reconnecting
...
Also includes some logging improvements and a small fix to track
speaking state and to send speaking packet if needed before sending
opus packets.
2016-05-26 19:35:17 -05:00
Bruce
942d3a8b66
Merge pull request #194 from iopred/status
...
Support streaming status updates.
2016-05-14 13:53:49 -05:00
Chris Rhodes
a8ecc78c34
Don't break the API.
2016-05-14 09:50:37 -07:00
Bruce Marriner
a00f64aa86
Don't stomp on VoiceConnection if exists already
...
This allows you to enable voice debugging prior to joining a voice
channel.
2016-05-12 19:23:38 -05:00
Chris Rhodes
80c2158605
Support streaming status updates.
2016-05-06 15:23:21 -07:00
Bruce Marriner
6a4b8bb287
Fixed it!
2016-05-01 19:55:57 -05:00
Bruce Marriner
cb9e30670f
no concurrent writes to voice ws, log cleanup
2016-05-01 19:54:28 -05:00
Bruce Marriner
5dc57e19c7
Display gateway url in error
2016-05-01 18:16:55 -05:00
Bruce Marriner
a9da8a5daf
Cleanup, Logging, Finished Resumed code.
2016-04-30 21:40:13 -05:00
Bruce Marriner
c65d5091ab
Fix resume bug! It's op not ip.
2016-04-30 20:29:27 -05:00
Bruce Marriner
9e8cd0a735
misc cleanup
2016-04-30 20:29:10 -05:00
Bruce Marriner
e9e9ef86b3
Prevent concurrent writes to gateway websocket.
2016-04-30 19:11:13 -05:00
Bruce Marriner
9bc6057ca7
partial support for gateway resume
2016-04-30 17:52:09 -05:00
Bruce Marriner
b09ed37294
reconenct with identify packet until resume is fixed.
2016-04-29 14:57:41 -05:00
Bruce Marriner
53a826dd0d
Send heartbeat in response to gateway Op 1 message
2016-04-28 22:30:42 -05:00
Bruce Marriner
d557bb24a5
Extra logging for non OP0 events, for now.
2016-04-28 21:50:57 -05:00
Bruce Marriner
f6de2b2c98
gateway, voice, & logging improvements
...
We now store teh sessionID of the gateway connection for later use. We
are now caching the gateway url and will use it until unable to connect
to that gateway. We're not longer smashing the VoiceConnections map
during reconnects which was causing Voice problems. Slight change to
log output format.
2016-04-28 21:15:32 -05:00
Bruce Marriner
94770635a9
Event handing improvements.
...
Corrected the Event struct to match it's new state based on Discord docs
and started tracking sequence number and sending it with heatbeats.
Also, move cleanup and comment improvements.
2016-04-28 16:59:45 -05:00
Bruce Marriner
2ac4665a4e
Clean up Gateway API Event handling.
2016-04-28 14:22:43 -05:00
Bruce Marriner
dd69a7e27f
Added logging statements
2016-04-28 09:27:57 -05:00
Bruce Marriner
250579eb3a
Fix incorrect handling of VOICE_SERVER_UPDATE
...
With this change, discordgo now properly supports
VOICE_SERVER_UPDATE events and will upon request
close existing connections and then re-open the
connection to the new voice endpoint. This allows
voice gateway redirects and voice region changes
to work even while a client is sending audio.
2016-04-28 07:43:31 -05:00
Bruce
5398a481cc
Merge pull request #167 from b1naryth1ef/feature/gateway-v4
...
Support Gateway v4
2016-04-26 20:15:02 -05:00
Bruce Marriner
4cac19c3f9
Do not start udp listener if deaf.
...
If you call VoiceChannelJoin and set deaf to true
then the library will not start a udp listener
2016-04-25 22:00:30 -05:00
Bruce Marriner
a258ec3011
Slight change to error message.
2016-04-25 15:33:40 -05:00
Bruce
cb6b3b956e
Revert "Add sharding support"
2016-04-25 13:24:00 -05:00
Bruce
b14a2ce8da
Merge pull request #171 from iopred/develop
...
Fix unmarshall error with Invite, improve error logging.
2016-04-23 22:35:51 -05:00
Chris Rhodes
bf9dda8404
Use json.Unmarshal in event handling so errors are better.
2016-04-23 11:58:19 -07:00
Chris Rhodes
8be21fb539
Fix unmarshall error with Invite, improve error logging.
2016-04-23 11:03:07 -07:00
andrei
92caf31b7f
Implement Guild Sharding
...
This implements the upcoming change (see hammerandchisel/discord-api-docs#17 )
to add guild-sharding support directly in the Discord Gateways.
2016-04-19 18:09:38 -07:00
andrei
ecc6e884c4
Support Gateway v4
...
This adds support for gateway v4 (which we're technically already
running; whoops). Really it just moves the version to the URL,
and explicitly uses JSON as the encoding. Everything should be supported
from previous commits.
2016-04-13 01:38:30 -07:00
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