Commit graph

155 commits

Author SHA1 Message Date
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
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
jonas747
c9d0ac8463 Update comment to UserGuild 2016-09-28 06:43:37 +02: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
cd6971839a Use the everyone role to initialise the permission flags. 2016-09-15 18:51:57 -07:00
soft as HELL
1ab71f4b12 Update GuildRoleEdit 2016-09-11 14:32:58 +03:00
jonas747
9344321923 Update GuildMembers to new format, #218 2016-07-31 17:20:12 +02:00
jonas747
3fd53413de Added userguild struct, and UserGuilds() now returns a userguild 2016-07-29 23:13:55 +02:00
daniel portella
f4b8e2ecc2 added ChannelSendFileWithMessage
kept it backwards compatible so previous apps dont crash with missing field.
2016-07-26 22:18:20 +01:00
Bruce
1dcb081f13 Merge pull request #230 from jonas747/funsplit
Fix ratelimit mutex with url parameters
2016-07-22 14:49:33 -05:00
Bruce Marriner
d28aed7326 Move deprecation comment so lint test passes 2016-07-19 07:45:00 -05:00
jonas747
a504a0adb9 Fix ratelimit mutex with url parameters 2016-07-19 14:18:49 +02:00
Bruce Marriner
ea72e85416 Deprecated Session.UserChannelPermissions
Created new UserChannelPermissions in State.
2016-07-18 17:04:00 -05:00
Bruce Marriner
5501cac820 Retry After Milliseconds, fixes #228 2016-07-11 22:34:34 -05:00
jonas747
092ed4b585 Retry on 502's 2016-07-11 22:30:11 +02:00
RealCodingTeam
12a226f56c huh 2016-06-28 11:10:38 -04:00
Chris Rhodes
b225864d96 Use State for UserChannelPermissions when possible. 2016-06-25 16:22:17 -07:00
Bruce
5f2a99e666 Merge pull request #217 from nstafie/develop
Add function to get a single message by ID
2016-06-17 16:51:34 -05:00
Bruce Marriner
fb663ac348 Linting 2016-06-17 15:44:01 -05:00
Nicholas Stafie
912d26b6bf
Add function to get a single message by ID 2016-06-15 16:37:55 +03: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
ae860ce166 Follow Go naming conventions. 2016-06-14 09:04:41 -05:00
Bruce Marriner
323216e171 Update GuildChannelsReorder with new endpoints 2016-06-04 19:50:20 -05:00
Bruce
15f6afb2d7 Merge pull request #211 from jonas747/guildchannelsupdate
Added GuildChannelsReorder
2016-06-04 19:46:18 -05:00
Chris Rhodes
3686cc7ce3 Support many more idioms. 2016-06-03 20:59:35 -07:00
jonas747
ca07a8f9d3 Change GuildChannelsUpdate to GuildChannelsReorder 2016-06-04 04:34:09 +02:00
jonas747
c13c190516 Added GuildChannelsUpdate 2016-05-30 11:51:51 +02:00
Bruce Marriner
dc3b3ea170 Merge branch 'develop' of https://github.com/bwmarrin/Discordgo into develop 2016-05-14 15:59:03 -05:00
Bruce Marriner
65a1d5cf6a Do not set content-type for GuildChannels endpoint 2016-05-14 15:58:39 -05:00
VagantemNumen
a2c826192f
Added check for maximum messages in the slice.
If more than 100 is present send the first 100 in the request and
ignore the rest.
2016-05-14 06:15:50 +05:00
VagantemNumen
35e6225f87
Added ChannelMessagesBulkDelete function.
Requires a channelID and a slice of messageIDs from the channel.
If only on ID is in the slice calls ChannelMessageDelete() internally.
If the slice of IDs is empty do nothing.
2016-05-14 05:27:41 +05:00
Bruce Marriner
ad2aa618dd Expand rate limit locks a little 2016-05-02 09:55:30 -05:00
jonas747
c8b796b223 Add GuildMemberNickname 2016-04-30 23:43:05 +02:00
Bruce Marriner
c8e6cbffcf Merge branch 'develop' of https://github.com/bwmarrin/Discordgo into develop 2016-04-28 21:18:53 -05:00
Bruce
9aaebf7100 Merge pull request #186 from jonas747/develop
Fixed ChannelMessageAck
2016-04-28 18:16:50 -05:00
Bruce Marriner
38c51ce788 Renamed RateLimited to RateLimit
This is more consistant with other event names.
2016-04-28 17:43:41 -05:00
Bruce Marriner
098d7861a4 BREAKING - Added RateLimited event
Renamed RateLimit struct to TooManyRequests{} and added new event struct
RateLimited{} which can be registerd to with AddHandler() and will be
emitted anytime a HTTP 429 is received on the HTTP API.
2016-04-28 17:41:05 -05:00
jonas747
beec086d69 Fixed ChannelMessageAck 2016-04-29 00:40:42 +02:00
Bruce Marriner
a24f9e3d10 Slight better rate limit handling
This improves greatly on the previous rate limit handling
however still needs review and possible improvement.
Please report bugs!
2016-04-28 13:38:20 -05:00
Bruce Marriner
e2e03c3078 Do not allow sending role colors > 0xFFFFFF 2016-04-25 15:19:23 -05:00
Bruce Marriner
11404bc598 Moved resquest api data log to request() func 2016-04-25 12:12:34 -05:00
Bruce Marriner
21739b0274 Add a little spacing when logging rest api requests 2016-04-25 12:05:02 -05:00