Commit graph

295 commits

Author SHA1 Message Date
Ceriath
fb0692b08d
Add example of emojiID to MessageReactionAdd (#798) 2022-04-08 01:23:20 +03:00
Adam Jarvis
c3c6c1b6c2
Payload for member edit (#1122)
* Create payload for Guild Member Edit

* Update rest API usage with new payload

* Update comment with ref to discord API

* Change data to pointer instead

* Change struct to just nick and roles

* Review comments

* feat(rest#GuildMemberEditComplex): return updated member and cosmetic changes

* feat(structs): renamed GuildMemberEditData to GuildMemberParams

* style(structs#GuildMemberParams): fix spacing

* fix(rest#GuildMemberEditComplex): use GuildMemberParams instead of GuildMemberEditData

Co-authored-by: nitroflap <fe.lap.prog@gmail.com>
2022-04-05 01:33:27 +03:00
Pancake-e
7e3d187823
Added Guild Members Search Function (#1150)
* Added Guild Members Search Function

* Updated method name to be consistent with other endpoints

* Refactored and moved GuildMembersSearch method for consistency
2022-04-04 16:26:45 +03:00
nitroflap
4637c5b7e8
feat(rest): add pagination params for GuildBans 2022-04-01 00:08:25 +03:00
Jim Eagle
cd724aa48a
IconURL for GuildPreview and GuildWithCounts (#885)
* Add missing field

* Helpers

* Renames

* Use helper

* Add withCounts query option to Guild()

* Move IconURL

* Add IconURL to GuildPreview

* Update comments

* Send `[]` rather than `null` on empty activities slice

* Add more robust file support for webhooks

* Add withCounts query option to Guild()

* Update comments

* Split guild func

* Update structs.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Update structs.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Revert

* Format yaml

* Add IconURL to GuildPreview

* Revert

* Revert space

* Update restapi.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Remove variadic

* Revert yamls

* Remove param

* Hardcode string

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-03-31 22:22:46 +03:00
Lucas Teske
1292ea9e38
fix: Fix debug message printing when debug is disabled. (#1043) 2022-03-29 16:00:28 +03:00
SwitchUpCB
12edb3b8c7
Move RESTError to restapi.go (#1130) 2022-03-14 00:26:43 +03:00
Shawn Toffel
ee34db7ade
Removed appID comment from InteractionRespond method without this parameter (#1123) 2022-03-07 13:38:34 +03:00
42Atomys
9448b0eb96
Add Guild Scheduled Event Support (#1032)
* Add Guild Scheduled Events support

* Add missing Indents for Guild Scheduled Events

* fix: Do update from new schedules updates and repository updates

* doc: Add missing documentation on const

* doc: Add missing documentation on events struct

* tests: Add a Skip condition when dgBot is not set to prevent segfault

* fix: Somes changes following the last review steps

* docs: Add an example to manipulate GuildScheduledEvent

* clean: Remove useless pointers on struct used to retrieve data

* tests: Test extra query params on GuildScheduledEventUsers requests

* clean: Remove unused variables

* feat: Add nullable types to provide null value to Discord API when is necessary

* feat: Use NullableString in ScheduledEvents

* docs: Add example for usage of NullableString

* Update structs.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Update restapi.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* fix: Review changes to move back nullable string into a simple MarshalJSON

* fix: Remove NullString on tests and examples

* doc: Add missing doc

* Update structs.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* fix: misunderstood MarhsalJSON

* fix: Follow the convention of discordgo on url.Values

* Update examples/scheduled_events/main.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* changes: use conditional instead on Sprintf

* fix: Add missing status on Params

* Update structs.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Update structs.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* changes: Move flag.Parse inside the init function

* fix: remove null statement of test suite

* fix: Rewrite Marshal of GuildScheduledEventParams to prevent a stack overflow on marshall same type

* clean: Remove unused Intents

* Update restapi.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Update restapi.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Update restapi.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* doc: polish the documentation

* clean: Final polish code

* doc: Add information about 1:1 usage

* Update discord_test.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* doc: remove unnecessary additional infos

* Update structs.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Update discord_test.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* Update restapi.go

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* chore(examples/scheduled_events): removed NullString comment

* fix(structs): grammar in comment to EntityType

* fix: run gofmt

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-02-27 18:22:31 +03:00
Andres Perez
dd5b9c6c05
Add Guild Member avatar (#1077)
* Add guild member avatar

* add avatar field on Member struct

* add endpoints for guild avatars

* add avatarURL util function for *User.AvatarURL and *Member.AvatarURL

* set GuildID on after GuildMember request

* fix Member.Avatar comment

* fix: gofmt

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-02-26 00:26:51 +03:00
Riley
8ac9c13dda
Guild Template (#1091)
* feat: guild templates

* task(endpoints): go fmt endpoints

* task(endpoints): go fmt

* docs(restapi): resolve suggestions from code review

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>

* fix(restapi): add missing image field

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-02-21 01:00:36 +03:00
Fedor Lapshin
992358e106
Threads reloaded (#1058)
* feat(endpoints): bumped discord version to 9

* feat: threads barebones

* feat(threads): documentation

* feat(threads): membership caching

* feat(threads): added type to StartThread method

* fix: replaced missing Timestamp definitions with time.Time

* chore: removed debug logs

* chore: removed thread alias for channel type

* feat(webhooks): separated thread option into method

* fix(state): ThreadMembersUpdate member duplication bug

* fix: golint

* feat(threads): pr fixes and BeforeUpdate in ThreadUpdate

* feat: removed unnecessary todo

* feat(state): removed thread last message update in MessageAdd

* Revert "feat(state): removed thread last message update in MessageAdd"

This reverts commit 4ca359fd2cc304e5d0ec2937e25c0c487a1f2096.

* feat(state): update only last message id for thread update

Implements updating message id in MESSAGE_CREATE and MESSAGE_DELETE events. Refer to https://discord.com/developers/docs/topics/gateway#thread-update for more info.

* fix(restapi): passing threadID in WebhookThreadExecute

* feat(state): dropped last_message_id updates for threads

* fix: gofmt

* feat(events#ThreadCreate): added newly_created field

* feat(restapi)!: corrected names of thread functions
2022-02-17 22:50:42 +03:00
Fedor Lapshin
e39ed2f8ce
feat(restapi): reworded comment of GuildApplicationCommandsPermissions 2022-02-16 22:38:08 +03:00
Bjorn Zandvliet
d5bacb5401
Add Default Permission to #943 (#1071)
* Create edit application command permissions endpoint

* Add remaining command permissions endpoints

* Clean up naming a bit

* Add docs for application command permissions endpoints

* Update comments

* More comments

* :^)

* Put the verb in API method names at the end

* Review feedback

* Add default permissions

* feat(restapi): rewording of comments to application command permissions endpoints

* fix(rest): errors for application commands permissions endpoints

* style(interactions): changed order of fields in ApplicationCommand

Co-authored-by: NotUnlikeTheWaves <hleistra@gmail.com>
Co-authored-by: nitroflap <fe.lap.prog@gmail.com>
2022-02-16 22:17:26 +03:00
nitroflap
a8b351019f
feat(*): dropped more undocumented endpoints 2022-02-08 20:43:43 +03:00
nitroflap
d5c82ad374
feat(*)!: dropped undocumented endpoints 2022-02-08 18:25:24 +03:00
Riley Smith
29269347e8
Add guild member timeouts (#1061)
* added guild member timeouts

* fix spelling error

* Use time.Time, allow timeout removal

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
2021-12-27 21:38:45 -05:00
xIceArcher
842ddb357a
Support for multiple embeds in message routes (#1000) 2021-10-10 10:56:47 -04:00
Carson Hoffman
f7454d039f
Add more safety around message reference misuse 2021-08-10 21:40:36 -04:00
Fedor Lapshin
4ebe5a08ee
Selects component (#954)
* Interactions: the Buttons (#933)

* Interactions: buttons

* Doc fix

* Gofmt fix

* Fix typo

* Remaking interaction data into interface

* Godoc fix

* Gofmt fix

* Godoc fix

* InteractionData helper functions and some fixes in slash commands example

* Fix components example

* Yet another fix of components example

* Fix interaction unmarshaling

* Gofmt fix

* Godoc fix

* Gofmt fix

* Corrected naming and docs

* Rolled back API version

* Requested fixes

* Added support of components to webhook and regular messages

* Fix components unmarshaling

* Godoc fix

* Requested fixes

* Fixed unmarshaling issues

* Components example: cleanup

* Added components tracking to state

* Requested fixes

* Renaming fix

* Remove more named returns

* Minor English fixes

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>

* Doc fix

* Gofmt fix

* Fix typo

* Remaking interaction data into interface

* Godoc fix

* Gofmt fix

* Godoc fix

* InteractionData helper functions and some fixes in slash commands example

* Fix components example

* Yet another fix of components example

* Fix interaction unmarshaling

* Godoc fix

* Gofmt fix

* Corrected naming and docs

* Rolled back API version

* Requested fixes

* Added support of components to webhook and regular messages

* Interactions: select menus

* Example fix

* Merge fix

* Some fixes

* Added missing documentation

* Fix components unmarshaling

* Godoc fix

* Requested fixes

* Fixed unmarshaling issues

* Components example: cleanup

* Gofmt fix

* Godoc fix

* URL field renaming fix

* Added flags to followups

* Updated components example

* Fixed typo in components example

* Merge fix

* Improve handling of invalid interaction situations

* support allowing webhook edits with files, and responding to interactions with files (#931)

* allow files in webhook message edits

* add Files to WebhookEdit struct

* move the construction of the multipart body for files into a shared function

* allow  interaction responses to have files

* go fmt

* fix err shadowing

* document MakeFilesBody

* rename MakeFilesBody -> EncodeWithFiles. fix InteractionRespond responding twice

* use resp in InteractionRespond files, add basic-command-with-files example command

* import strings and go fmt

* EncodeWithFiles -> MultiPartBodyWithJSON

* go fmt

* fix example for slash_commands

* move files to responsedata

* Merge fixes

* Fixed rebase consequences

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
Co-authored-by: plally <pierce@vulpes.dev>
2021-08-08 20:16:07 -04:00
plally
ab47f123ba
support allowing webhook edits with files, and responding to interactions with files (#931)
* allow files in webhook message edits

* add Files to WebhookEdit struct

* move the construction of the multipart body for files into a shared function

* allow  interaction responses to have files

* go fmt

* fix err shadowing

* document MakeFilesBody

* rename MakeFilesBody -> EncodeWithFiles. fix InteractionRespond responding twice

* use resp in InteractionRespond files, add basic-command-with-files example command

* import strings and go fmt

* EncodeWithFiles -> MultiPartBodyWithJSON

* go fmt

* fix example for slash_commands

* move files to responsedata
2021-07-30 11:22:08 -04:00
Xpl0itR
e72c457cb4
Get webhook message endpoint (#948)
* Get interaction response message by interaction token

* Rename methods
2021-06-17 17:19:10 -04:00
Eric Wohltman
9c33bfbada
Update unmarshal function to wrap ErrJSONUnmarshal and return specific error message. Requires at least Go 1.13. (#924) 2021-05-14 22:30:27 -04:00
Pierce
7d7206b01b
Bulk command overwrite (#926)
* add session.ApplicationCommandBulkOverwrite

* change ApplicationCommandBulkOverwrite to take a guildID

* formatting

* add omitempty to ID of ApplicationCommand
2021-05-11 23:51:33 -04:00
Carson Hoffman
182d9b48f3
Add more robust file support for webhooks 2021-03-14 12:27:22 -04:00
Fedor Lapshin
b0fa920925
Slash commands (#856)
* UnknownBan error code addition

* GuildBan method implementation

* Gofmt fix

Gofmt fix

* Interactions: application commands basic API and gateway integration

* Some gitignore update

* Application commands and interactions API implementation

* Some fixes

* Some improvements of slash-commands example and slash-commands API

* OAuth2 endpoints backward compatibility

* Gofmt fix

* Requested fixes and documentation improvement for application commands

* Some fixes

* New and more interesting example of slash-commands usage, merging "interaction.go" and "interactions.go" into a single file. And some fixes.

* Gofmt and documentation fixes

* More fixes

* Gofmt fixes

* More fixes!

* Doc and endpoint fixes

* Gofmt fix

* Remove dependence on open gateway connection

* Remove redundant command ID checks

* Fix typo in ApplicationCommandCreate comment

* Tidy up function calls returning body

* Add upcoming API changes

* Correct return value name, swap parameter order

* Add Version field to ApplicationCommand

* Fix up language in comments

* Remove redundant conversion to float64

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
2021-02-28 21:54:02 -05:00
Jim Eagle
4617d8e379
Add guild preview endpoint (#818) 2021-02-24 12:10:18 -05:00
Carson Hoffman
c27ad65527
Sleep for correct duration after 429 2021-02-05 13:06:05 -05:00
AlexPresso
b6deecb67d
Add MessageReactionsRemoveEmoji (#873)
* Add MessageReactionsRemove

* Add MessageReactionsRemove

* Rename MessageReactionsRemove to MessageReactionsRemoveEmoji

Co-authored-by: Qais Patankar <qaisjp@gmail.com>

* Update MessageReactionsRemoveEmoji comments

Co-authored-by: Qais Patankar <qaisjp@gmail.com>
2021-02-03 19:13:48 -05:00
Alex
5f6bb2d120
Set channel and role edit perms to int64 (#867)
* set channel and role edit perms to int64

* add string serialization
2021-01-27 12:55:31 -05:00
Carson Hoffman
daaafb5a7f
Rename fields for v8 2021-01-20 18:22:39 -05:00
Carson Hoffman
3773e286e6
Add v8 permissions changes 2021-01-20 18:11:20 -05:00
denverquane
e2c5d80fa6 Fix invalid RateLimit event type 2020-12-30 13:50:52 -07:00
Fedor Lapshin
f124f38563
GuildBan method and UnknownBan error code addition (#848)
* UnknownBan error code addition

* GuildBan method implementation

* Gofmt fix

Gofmt fix
2020-12-17 13:59:41 -05:00
Alexey
1b13267ba4 Add support for sending message reply 2020-11-20 16:11:12 +03:00
Chris Rhodes
7ab242d361 Add State helper methods for reading permissions and role colors from Message roles. 2020-10-16 18:09:59 +11:00
Aditya Diwakar
4b6abc53af
Add Guild Member Mute/Deaf Edit Support (#804)
*  Add member edit deaf/mute support

* Resolve omitempty issues
2020-08-12 10:24:33 -04:00
Aditya Diwakar
b7ef3c8e0f Handle error in ChannelNewsFollow 2020-08-06 19:31:43 -04:00
Aditya Diwakar
eb70c17733 Add support for retrieving Webhook ID 2020-08-05 18:54:12 -04:00
Aditya Diwakar
10195fcfbb Add support for news channels
Endpoint support added:
- @/channels/:id/messages/:id/crosspost - publishes a message in a news
  channel to followers
- @/channels/:id/followers - follows a news channel
2020-08-05 18:31:38 -04:00
Robbie Trencheny
4738844e34
Rename GuildEmoji to GuildEmojis 2020-06-28 16:02:02 -07:00
Robbie Trencheny
f193d81d83
Add GuildEmoji function 2020-06-28 16:01:21 -07:00
Dylan Meador
9c46cf4ec7
Update GuildMemberMove to support removing from all voice channels (#789) 2020-06-28 18:34:50 -04:00
b-o-r-k
a853557f4d
Add missing fields in GuildChannelCreateData (#782)
According to https://discord.com/developers/docs/resources/guild#create-guild-channel, the endpoint also accepts the following fields:

- rate_limit_per_user: integer
- position: integer
2020-06-15 11:14:01 -07:00
Noah Santschi-Cooney
69edfdf4ac
discordapp.com -> discord.com (#772)
Change API URL from discordapp.com to discord.com
2020-05-08 21:26:13 -04:00
Carson Hoffman
45124d8303 Revert "Changed domain from discordapp.com to discord.com (#769)"
This reverts commit f4ca8874a3.
2020-05-07 12:27:07 -04:00
Hunter Paulson
f4ca8874a3
Changed domain from discordapp.com to discord.com (#769)
* Allow resume on reconnect

* Version 0.20.3: allow resume on reconnect

* Update index.md

* Update README.md

* Update GettingStarted.md

* Update endpoints.go

* Update README.md

* Update event.go

* Update wsapi.go

* Update restapi.go

* Resolved spelling issue

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
2020-05-04 21:13:28 -07:00
Carson Hoffman
525ac13aa7
Merge pull request #626 from AtomGrafiks/master
Add pagination to MessageReactions
2019-12-26 20:42:56 -05:00
Carson Hoffman
afe392e6c1
Merge pull request #694 from BigHeadGeorge/fix-tts-casing
Fix inconsistent TTS casing
2019-12-26 20:22:41 -05:00
Carson Hoffman
e4e03cf8b5
Merge pull request #683 from recapitalverb/develop
Remove State fallback from Session#Guild
2019-12-26 19:46:40 -05:00