Commit graph

314 commits

Author SHA1 Message Date
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
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
54e0bd6087 Fix Admin permission calculations. 2016-11-29 19:09:01 -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
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
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
Chris Rhodes
8be21fb539 Fix unmarshall error with Invite, improve error logging. 2016-04-23 11:03:07 -07:00
Chris Rhodes
24e7f04e0e Add support for GuildEmbed and GuildIntegration endpoints. 2016-04-22 11:34:04 -07:00
Bruce Marriner
1a672823a2 Lint and Cleanup 2016-04-11 18:54:19 -05:00
jonas747
d1f25d8561 Changed fmt.Print to log.Print 2016-03-21 17:13:39 +01:00
Bruce Marriner
f9bf5fb040 Added HTTP 201 to Request and gofmt :) 2016-03-11 13:43:45 -06:00
abalabahaha
539b9d203f Fix UserChannelPermissions 2016-03-04 05:50:11 -08:00
abalabahaha
cd24674ebb Added UserChannelPermissions function 2016-03-04 08:07:57 +00:00
noisypixy
ce9840f8c4 Constant missing in Go < 1.6 2016-03-02 21:13:53 -04:30
noisypixy
6c820412cf Replace HTTP status codes for net/http constants. 2016-03-02 19:26:00 -04:30
Nicholas Stafie
58fe658fa5 Add VerificationLevel value consts and a typedef for int 2016-02-27 00:28:05 +02:00
Bruce
226df093f6 Merge pull request #132 from nstafie/develop
BREAKING -- Add support for setting guild region and verification level
2016-02-26 14:58:56 -06:00
Bruce Marriner
a45e493e1f Add limit max values in comments 2016-02-24 23:29:59 -06:00
Nicholas Stafie
f5ac3b10bf
Better document GuildEdit arguments 2016-02-25 00:31:51 +02:00
Nicholas Stafie
1a844d697d Add support for guild region and verification level 2016-02-25 00:27:13 +02:00
Bruce
f67b8152cf Merge pull request #127 from iopred/docs
BREAKING -- Change API for ChannelMessages to accept Message ID's as strings. Fixes #120
2016-02-20 17:33:59 -06:00
Bruce Marriner
c3cb8469bb Removed GuildInviteCreate function. 2016-02-20 17:03:07 -06:00
Chris Rhodes
50b7bdd6ff Change API for ChannelMessages to accept Message ID's as strings. Fixes #120 2016-02-20 14:21:25 -08:00
Bruce Marriner
e1a88003e6 Will use current rate limit method for forseable future, closes #12 2016-02-20 15:56:07 -06:00
Bruce Marriner
e0010ab0ba Add limit and offset to GuildMembers, closes #105 2016-02-19 00:42:52 -06:00
Bruce
f801d95c14 Merge pull request #114 from iopred/guilds
Partial support new GuildMember endpoints.
2016-02-18 21:56:07 -06:00
Chris Rhodes
ab2ab944bb 👌 2016-02-18 00:01:23 -08:00
Bruce Marriner
22bb771120 Added func GuildMemberMove, closes #92 2016-02-18 00:39:53 -06:00
Chris Rhodes
0ea10a300b Merge branch 'develop' into guilds 2016-02-15 20:20:53 -08:00
Bruce Marriner
aebfb09719 Baby Linting. 2016-02-15 21:50:41 -06:00
Bruce
0dea8696c0 Merge pull request #110 from iopred/guildleave
Support new guild leave API.
2016-02-15 20:59:15 -06:00
Chris Rhodes
32dc320386 👌 2016-02-15 18:39:43 -08:00
Chris Rhodes
0bd7fbf668 Support new leave API. 2016-02-15 18:38:15 -08:00
Chris Rhodes
64af0e5f4a Support TTS. Closes #67 2016-02-13 18:28:29 -08:00
Chris Rhodes
ddc830a071 Add new guild endpoints. 2016-02-13 10:28:34 -08:00
Chris Rhodes
4a9689f953 Cleanup 2016-02-11 21:39:18 -08:00
Chris Rhodes
0344155b17 Support sending files. 2016-02-11 21:36:19 -08:00
Bruce Marriner
af52a8c822 Fix type, thanks KuroiKitsu 2016-02-07 20:47:33 -06:00
Bruce Marriner
edc09778a7 Linting. 2016-01-28 08:36:09 -06:00
Bruce Marriner
53db54ea8c Comment. 2016-01-27 23:41:44 -06:00
Bruce Marriner
21272c5460 no formatting directive in Errorf call 2016-01-27 23:34:57 -06:00
Chris Rhodes
5aab9dc685 Use an array of role ids 2016-01-27 09:45:14 -08:00
Chris Rhodes
b0188cd71e Support GuildMemberEdit api. 2016-01-27 01:37:43 -08:00
Bruce Marriner
654c78a419 Renamed GUILD_MEMBER_DEL endpoint to just GUILD_MEMBER 2016-01-19 08:56:48 -06:00
Chris Rhodes
1d9f97e283 Update New to allow an auth token to be specified. 2016-01-17 14:17:51 -08:00
Chris Rhodes
e2ab871e12 Fix colliding vars. 2016-01-17 11:59:22 -08:00
Chris Rhodes
3561ad1fa6 Add a LoginWithToken method which is a cheaper way to login. Closes #89.
Eventually we should consider allowing Login/LoginWithToken to mutate
s.Token, it would probably simplify the API a bit.
2016-01-17 11:13:02 -08:00
Chris Rhodes
a6a218d2fd Avoid a potential issue where State tracking was disabled and it would return a stale Guild. 2016-01-12 11:32:02 -08:00
Chris Rhodes
b4dfce0fee Add methods for grabbing guild images. Clean up some docs. 2016-01-12 11:14:51 -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
Chris Rhodes
5b312ac464 Handle errors from Request. 2016-01-11 16:24:17 -08:00
Chris Rhodes
b26c168d94 Remove the userID param from UserSettings. 2016-01-11 12:17:53 -08:00
Bruce Marriner
6de9b19ac8 Merge branch 'develop' of https://github.com/bwmarrin/Discordgo into develop 2016-01-11 12:09:30 -06:00
Bruce Marriner
614ecda516 Fix Logout function. Closes #50 2016-01-11 12:06:25 -06:00
Chris Rhodes
d52e39a592 Move non @me methods higher, modify UserGuilds. 2016-01-10 21:23:15 -08:00
Chris Rhodes
918ee4205d Make User commands accessible only to @me 2016-01-10 21:20:19 -08:00
Chris Rhodes
00cd5cb178 Return an image.Image for user avatars. Also fix some missing pointer returns. 2016-01-10 19:36:52 -08:00
Bruce Marriner
4bdb631758 Initial, very basic, support for dealing with rate limits 2016-01-10 19:40:03 -06:00
Bruce Marriner
b5e45827fd Better error checking for New() and Gateway() funcs, closes #75 2016-01-10 19:01:34 -06:00
Bruce Marriner
3357c56626 Minor changes to Request() func, closes #73 2016-01-10 17:30:19 -06:00
Seth Moore
e755370170 Fix return type... 2016-01-10 10:50:08 -05:00
Seth Moore
054115bc89 Fix Login crash by returning immediately 2016-01-10 10:43:47 -05:00
Bruce Marriner
c2fd09c51d Fix error introduced by SHA: 30252123a0,
closes #66
2016-01-09 14:22:34 -06:00
Chris Rhodes
129832e3d5 Fix login token issue. 2016-01-08 13:58:56 -08:00
Chris Rhodes
0d7b6f7e76 Convert structs and api to use pointers. 2016-01-08 09:37:34 -08:00
Bruce
351f477135 Merge pull request #55 from Rivalo/develop
Add support for registering a new account, closes #49
2016-01-07 19:22:12 -06:00
Rivalo
46a8f39f38 Revert "Added UserVerify function"
This reverts commit 7179f550b4.
2016-01-08 02:01:06 +01:00
Bruce Marriner
50394ab954 Merge branch 'develop' of https://github.com/bwmarrin/Discordgo into develop 2016-01-07 13:50:55 -06:00
Bruce Marriner
301fb980d3 Updated copyright year, cleaned up some comments. 2016-01-07 13:50:44 -06:00
Bruce Marriner
d6314c034e Fixes for compatibility with Go 1.3, closes #56. 2016-01-07 13:28:33 -06:00
Rivalo
7179f550b4 Added UserVerify function 2016-01-07 19:44:50 +01:00
Rivalo
a6e3be7a36 Added register function 2016-01-07 19:00:35 +01:00
Bruce Marriner
f1775b9440 Removed comment. 2016-01-06 16:35:26 -06:00
Seth Moore
2d7ac3557a Prevent login crash by assuming a json.Unmarshal "just works" 2016-01-06 12:52:30 -05:00
Bruce
f2ccbd3522 Merge pull request #36 from iopred/bans
Modifications to GuildBanAdd, closes #29 #33.  Idiomatic improvements to ChannelMessages func.
2015-12-29 13:19:59 -06:00
Chris Rhodes
6400f08039 Modify GuildBanCreate to have a days param. Clean up ChannelMessage. 2015-12-29 10:29:10 -08:00
Bruce Marriner
57a5245657 Added support for setting channel permission overrides, closes #20 2015-12-29 10:24:19 -06:00
Chris Rhodes
f242890ade Update printf types for GuildBanCreateAndDeleteComments. 2015-12-28 21:00:38 -08:00
Chris Rhodes
093f97f2bc Implement GuildBanCreateAndDeleteComments 2015-12-28 20:53:00 -08:00
Chris Rhodes
e836b7a500 Rename GuildBanAdd to GuildBanCreate 2015-12-28 20:52:59 -08:00
Bruce Marriner
850901a5dc Updated ChannelMessageSend to reflect new mention method used by Discord, closes #9 2015-12-23 23:50:19 -06:00
Bruce Marriner
dfb0b891fd Added support functions for guild role fetching and management, closes #21 2015-12-23 20:09:16 -06:00
Bruce Marriner
ebbe3e3828 Fixed bug in restapi.go where UserUpdate data struct was not declared correctly. 2015-12-21 11:25:37 -06:00
Bruce Marriner
ac06a113ce Improvements to Request func closes #32, addition of UserUpdate func closes #19 2015-12-21 11:16:00 -06:00
Bruce Marriner
bd1e20549a Removed /guilds/:guild_id/members endpoint, closes #14 2015-12-17 14:11:10 -06:00
Bruce Marriner
bb60b64ecb Made User-Agent version a variable. 2015-12-17 11:44:11 -06:00
Guillaume Desvé
ec31caac1b Add DiscordBot user agent 2015-12-16 17:25:39 +01:00
Bruce Marriner
dd4aef7263 Added AutoMention option to parse MessageSend for any <@ID> tags. 2015-12-06 17:04:05 -06:00
Bruce Marriner
ea647f9a61 All REST API JSON now created via structs instead of interface or strings 2015-11-24 16:17:14 -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
dd1d8eabbf Fixed several functions incorrectly returning an Array - THANK YOU Pikachu :) 2015-11-17 21:13:06 -06:00
Bruce Marriner
ca590e6262 removed unneeded import 2015-11-16 21:51:31 -06:00
Bruce Marriner
5144b323e6 Updates to make code more idiomatic Go 2015-11-16 21:51:04 -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
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
f87340f1e8 Fixed bugs from last commit :) 2015-11-14 17:47:59 -06:00
Bruce Marriner
2448f72489 Major rewrite of REST API to include constants for all endpoints 2015-11-14 15:46:33 -06:00
Bruce Marriner
9076028987 Added VoiceRegions and VoiceIce. Clean up endpoint constants 2015-11-14 11:22:00 -06:00
Bruce Marriner
3794c1a31e Added Guild Role Update handler 2015-11-13 19:38:35 -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
c858d08208 Fixed login, so it works :) 2015-11-09 15:42:52 -06:00
Bruce Marriner
4cb734f809 Fixed AU_ consts 2015-11-09 15:31:45 -06:00
Bruce Marriner
7738fea746 Comments, TODO list. 2015-11-09 15:10:10 -06:00
Bruce Marriner
6778771309 Added all known endpoints as variables, updated funcs to use them. 2015-11-09 14:55:31 -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
Renamed from client.go (Browse further)