Commit graph

864 commits

Author SHA1 Message Date
jonas747
dce3ada92b Proper ratelimit buckets for RoleAdd and RoleRemove (#311) 2017-01-14 10:04:36 -08:00
jonas747
bdb31f245d Fix all found race conditions, and dont send on nil channel (#307) 2017-01-10 20:01:47 -08:00
Bruce
53842f8dfc Merge pull request #306 from Moonlington/develop
BREAKING add Around parameter to ChannelMessages, fixes #293
2017-01-03 09:59:50 -06:00
Floretta
dacb0a3a0c Added comment line describing the around parameter 2017-01-03 16:42:27 +01:00
Floretta
c4c9502072 added Around parameter to ChannelMessages 2017-01-02 22:49:03 +01:00
Chris Rhodes
d22169d60f Remove type checks for handlers, it's done implicitly in the handlerForInterface call. (#305) 2016-12-29 09:58:51 -08:00
jonas747
6fd80199bf Handle MessageDeleteBulk event (#304)
* Handle MessageDeleteBulk event

* Changed State.MessageRemove to use id's

* Revert State.MessageRemove change and add State.messageRemoveById

* Fix linting
2016-12-28 12:29:36 -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
jonas747
edc3213ffb Reuse http client, and export it (#301) 2016-12-25 16:23:11 -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
jonas747
3fdc5f373d Add "PermissionAdministrator" to "PermissionAll" (#302) 2016-12-24 11:36:14 -08:00
Bruce Marriner
cb96c5b0f7 Log voice connect error in the right place. 2016-12-20 12:00:34 -06:00
Bruce Marriner
2730035a13 Don't error if we're never going to use it. 2016-12-11 13:07:15 -06:00
Bruce Marriner
7811077148 Handle error better. 2016-12-11 12:57:58 -06:00
Bruce Marriner
97d4489481 Check for errors :) 2016-12-11 12:55:06 -06:00
Bruce Marriner
cc272d6f14 Linting.. 2016-12-11 12:50:12 -06: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
fb346787be Improve permissions. (#298)
* Fix permissions to take into account @everyone override in channels.

* Keep early exit for channel owner.
2016-12-10 20:31:16 -08:00
Chris Rhodes
96d7ebfb70 Generate type assertion code. Don't generate interfaceProviders for internal handlers. (#297)
* Generate type assertion code. Don't generate interfaceProviders for internal events.

* Don't bother type checking interface providers, it's done in the init() call.
2016-12-10 20:31:07 -08:00
jonas747
86a21ea94b Updated userguilds to new api (#296)
* Updated userguilds to new api

* Fixed typos
2016-12-10 09:45:07 -08:00
Chris Rhodes
8b24e88bc5 Bump version to 0.16.0-dev 2016-12-10 06:47:49 -08:00
Bruce
0759785277 Merge pull request #294 from iopred/reflect
Remove the use of reflect.
2016-12-08 10:19:13 -06:00
Bruce Marriner
e650021037 Test against 1.6 and 1.7, make lint fatal again. 2016-12-08 10:16:37 -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
24a51f654f 👌 2016-11-30 18:02:13 -08:00
Chris Rhodes
9f7a7c9352 Don't stomp on messages or permission overrides on ChannelUpdate. 2016-11-30 17:59:17 -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
315ae45231 Set GuildID on all members in discordgo land not in state. 2016-11-29 20:23:10 -08:00
Matthew Gerstman
d726f93375 Fix issue with trailing slashes in MacOS (#292)
* Fix issue with trailing slashes in MacOS
2016-11-29 19:24:22 -08:00
Chris Rhodes
20d230cd04 Update GuildID's on GuildAdd 2016-11-29 19:17:03 -08:00
Chris Rhodes
54e0bd6087 Fix Admin permission calculations. 2016-11-29 19:09:01 -08:00
Chris Rhodes
1bc3fb9cd7 Set the GuildID for Members and VoiceStates on ready. 2016-11-29 19:05:09 -08:00
Chris Rhodes
03343b41fd Update discord.go 2016-11-23 17:18:37 -08:00
rytone
3f6a127baa Support for editing messages with embed data (#290) 2016-11-19 20:28:52 -08:00
Chris Rhodes
717c8f2538 Support embed messages. 2016-11-13 22:04:30 -08:00
Chris Rhodes
b7c7e60fd5 Fix presence unmarshalling as the values are inconsistent from Discord. (#287) 2016-11-12 11:59:51 -08:00
Chris Rhodes
c352d7016c Clean up ordering of internal handlers. (#285) 2016-11-12 11:50:06 -08:00
Chris Rhodes
c5a94de19c Silence missing voice op codes. 2016-11-11 08:20:00 -08:00
Chris Rhodes
8f6d44ccee Fix GuildBans. 2016-11-09 22:27:12 -08:00
AI
ed7a451a31 Add support for relationships (#284)
* Add support for relationships

Adds Support for:
  - Sending friend request.
  - Accepting friend request.
  - Getting all the relationships.
  - Getting all the mutual friends with another user.
  - Blocking a user.

**Note:**
  - Bot accounts are not allowed to access the endpoint.
  - May close bwmarrin/discordgo#150

* Implement requested changes

Changed the uint8 declarations to int.

* Change the missed unint8 declaration to int

Missed one instance of unint8 during previous push.
2016-11-08 17:07:04 -08:00
AI
602885488b Fix supprt for reaction endpoint (#283)
- Adds support for deleting the reaction for a given user.
    - Requires MANAGE_MESSAGES permission.
  - Fixes the Sesssion.MessageReactions(...) function.
2016-11-08 11:49:30 -08:00
AI
982cd7d7c3 Add support for the prune endpoint (#282)
* Add support for the prune endpoint

Adds functions to get the amount of members that could be pruned
and to prune members using the prune endpoint.
May close: bwmarrin/discordgo#147

* Deal with the go vet error

Removed the json tags from the unexported struct.
Should pass the tests now.

* Make the PR consistent with the rest of the file.

Removes url building in favour of string concatenation.

* Fix the previous commit

Adds back the result struct.
Converts the uint32 to string.

* Deal with golint comments

* Remove the failing test

Cleans up the uri concatenation.
Removes the failing test due to incorrect permissions.
2016-11-07 16:06:08 -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
Chris Rhodes
3e7c0435bc Reduce severity of wsConn close error logging. 2016-11-05 00:16:15 -07: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
5a40e65c72 Merge pull request #276 from iopred/develop
Fix GuildBans. Fixes #263
2016-11-03 22:46:02 -07:00