Commit graph

156 commits

Author SHA1 Message Date
jonas747
9d3cd03314 Add GatewayBot 2017-07-10 18:31:26 +02: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
AAAAAAAAAAA
eed1d20f1a Fix presence unmarshal with game names as numbers (#381)
* Game name is also not validated on the server

* Use json.Number instead
2017-05-08 08:32:00 -07:00
legolord208
25c8012990 Added missing permission constants (#378) 2017-05-08 06:43:50 -07:00
LEGOlord208
65f0cb9f73 Arise error when user has 2FA (#359)
* Arise error when user has 2FA

* Fixed error message

* Removed ticket
2017-04-18 21:35:17 -07:00
LEGOlord208
7bcc0fbaca Added more fields (#354)
* Added more fields

* Fixed error

* Yep ok
2017-04-11 21:51:24 -07:00
Ammar Bandukwala
52ad9e2feb add String() method to User (#350)
* add String() method to User

* put User def in it's own file

* remove usage of t.Run for support w/ older Go versions
2017-04-07 08:19:48 -07:00
Alexander
2e65ecdbb9 Fixed casing for JSON tag for Avatar field on User struct (#339)
When marshalling a user back to JSON, this results in inconsistently cased JSON fields.
2017-03-16 07:05:54 -10: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
jonas747
edc3213ffb Reuse http client, and export it (#301) 2016-12-25 16:23:11 -08:00
jonas747
3fdc5f373d Add "PermissionAdministrator" to "PermissionAll" (#302) 2016-12-24 11:36:14 -08:00
Bruce Marriner
9e777a083b Linting. 2016-12-11 12:45:34 -06:00
Bruce Marriner
68a784327f Merge branch 'develop' of https://github.com/bwmarrin/discordgo into develop 2016-12-11 12:24:29 -06:00
Bruce Marriner
c541df15df Removed dead code. 2016-12-11 12:24:17 -06:00
Chris Rhodes
db2f9eb29b Support getting the color of a user. (#299) 2016-12-10 21:37:11 -08: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
AI
2092185ec5 Implement support for new member role endpoint (#289)
Implements support for the new member role add and delete endpoint
hammerandchisel/discord-api-docs#179
2016-11-30 08:57:22 -08:00
Chris Rhodes
b7c7e60fd5 Fix presence unmarshalling as the values are inconsistent from Discord. (#287) 2016-11-12 11:59:51 -08:00
jonas747
5d1dd7ddac Add nick and roles to Presence 2016-11-07 15:53:54 -08:00
jonas747
f0cb678022 Add member_count to guild 2016-11-06 09:09:54 -08:00
jonas747
56b19073d3 Ratelimits (#273)
* Added ratelimiter

Handles the new ratelimit headers
 - X-RateLimit-Remaining
 - X-RateLimit-Reset
 - X-RateLimit-Global

* Pad only reset time with a second

* Moved ratelimiter out of internal package

* Change for loop, move global ratelimit check inside sleep check

* Moved ratelimiter locking to getBucket

* Added global bucket

* Changed how bucket id's are done

Now each request function will need to specify the bucket id if the
endpoint contains minor variables

* Allow empty bucketID in request

* Remove some uneeded Endpoint* function calls

* Added test for global ratelimits

* Fixed a silly little mistake causing incorrect ratelimits

* Update test comments, Fixed treating a endpoint as 2 in ratelimiting

* Use date header from discord instead of relying on sys time sync

* Update all REST functions to use RequestWithBucketID

* Embed mutex into bucket

* Added webhook and reaction buckets
2016-11-04 08:07:22 -07:00
Chris Rhodes
5ef835fc80 Fix GuildBans. Fixes #263 2016-11-03 22:39:55 -07:00
Chris Rhodes
c96162c425 Add support for Message Reactions. 2016-11-03 22:07:06 -07:00
Chris Rhodes
84a92549bc Merge pull request #274 from iopred/develop
Add Webhook support.
2016-11-03 19:47:15 -07:00
Chris Rhodes
ee3e500749 Add webhook support. 2016-11-03 19:41:57 -07:00
jonas747
9187964002 Added custom rest error type (#271) 2016-10-13 19:13:42 -07:00
jonas747
9f24531220 Update ChannelMessageAck because of api changes (#270) 2016-10-13 12:42:05 -07:00
robbix1206
af3fe4842a Add Support of changing user status (#258)
Add Support of changing user status
2016-09-28 10:04:37 -07:00
Chris Rhodes
581f6e7867 Merge pull request #256 from jonas747/request-members
Added RequestGuildMembers to request guild members from the gateway
2016-09-27 22:08:36 -07:00
Chris Rhodes
ef83d2098f Merge pull request #236 from jonas747/split
Added UserGuild struct, UserGuilds now returns a UserGuild slice
2016-09-27 22:04:37 -07:00
Chris Rhodes
42e934d3b2 Merge pull request #246 from robbix1206/timestamps
Timestamps
2016-09-27 21:22:07 -07:00
Chris Rhodes
8bd3f75441 Merge pull request #227 from jonas747/retry
Retry on 502's
2016-09-27 21:19:25 -07:00
Chris Rhodes
9b6b657083 Merge pull request #249 from iopred/develop
Correctly merge GUILD_UPDATE events. Closes #242
2016-09-27 21:15:03 -07:00
jonas747
9c7c9d3fd2 Added RequestGuildMembers to request guild members from the gateway 2016-09-25 21:29:59 +02:00
soft as HELL
ef3cd76e3d Add mentionable to Role struct 2016-09-11 14:32:41 +03:00
Chris Rhodes
678756c9a9 Simplify Guild.Unavailable and correctly merge GUILD_UPDATE events. 2016-09-08 19:39:29 -07:00
jonas747
2a1f0ff893 Added the CHANNEL_PINS_UPDATE event 2016-07-29 23:40:56 +02:00
jonas747
3fd53413de Added userguild struct, and UserGuilds() now returns a userguild 2016-07-29 23:13:55 +02:00
uppfinnarn
0c11cae782 Timestamp type; a string with a Parse() function
Closes #204
2016-07-28 21:16:10 +02:00
jonas747
092ed4b585 Retry on 502's 2016-07-11 22:30:11 +02:00
Bruce Marriner
af57bc1789 comment Deprecation for VoiceReady and UDPReady 2016-06-24 13:10:56 -05:00
Bruce Marriner
eeb2d4f62d Add mfa_enabled to User struct 2016-06-24 11:55:52 -05:00
Bruce
79d49f86fb Merge pull request #216 from jonas747/userguildsettings
Added UserGuildSettingsEdit
2016-06-15 08:30:01 -05:00
jonas747
f2f2d6430b Added UserGuildSettingsEdit 2016-06-15 12:07:57 +02: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
cec33d9477 Arange struct to reduce memory usage. 2016-06-14 09:05:19 -05:00
andrei
835a23a89d Implement guild sharding 2016-06-13 15:34:40 -07:00
Chris Rhodes
323abd1a87 Use embedded Presence in presenceUpdate 2016-06-05 22:41:08 -07:00
jonas747
caadaaaf2c Added guild_positions field to settings 2016-05-18 02:40:41 +02:00