Commit graph

328 commits

Author SHA1 Message Date
Jonas
33ffff21d3
Add Entitlements / SKUs (#1552)
Pull Request: https://github.com/bwmarrin/discordgo/pull/1552

Copied Message from Commits:

* add entitlement struct

* add entitlements field to interaction struct

* add event handler for entitlements

* add description to Entitlement struct & type

* properly format changes in entitlement and events

* format entitlement with gofmt

* move entitlement to structs

* add subscription id to entitlement struct and add omitempty

* add endpoints

* add comments to EntitlementTest and EntitlementOwnerType

* add sku struct

* add skus

* fix typo

* rename skuid in entitlement struct

* add comments to SKUFlags

* change entitlement timestamps to time.Time

* rename skuid in entitlement-test struct

* add documentation

* remove undocumented subscriptionID field in entitlement struct

* add documentation

* update documentation

* change order of EntitlementType values

* move optional entitlement filter options into a separate struct

* add premium button component

* add subscriptions

* optimize optional fields in entitlement struct

* Add documentation

* typo

* remove unneccessary pointers
2024-12-08 17:16:00 +10:00
Big Iron
247b6f7a76
Application Emojis (#1566)
---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2024-10-06 19:53:15 +03:00
Fedor Lapshin
e189ee5de8
feat(Session.UserUpdate)!: add banner support (#1509) 2024-06-21 10:41:08 +03:00
Fedor Lapshin
d26ad10ba6
feat: implement polls (#1525)
* feat: add poll events

* feat: add poll structs

* feat(MessageSend): add poll field

* feat(InteractionResponseData): add poll field

* feat: add endpoints
2024-06-21 10:37:32 +03:00
Shadat Rahman
33ee38cbf2
feat(UserGuilds)!: support with_counts parameter (#1500)
---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2024-03-15 18:22:29 +03:00
Cyb3r Jak3
15ef2a43d4
fix!: return Webhook struct from WebhookEdit and WebhookEditWithToken (#1497) 2024-02-16 17:06:04 +03:00
AlexeyOplachko
7f80bc7978
fix(message)!: omit empty Components and Embeds (#1483)
---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2024-02-03 02:59:38 +03:00
Earlopain
30b2cf22b4
feat(guild): implement onboarding (#1401)
Add guild onboarding endpoints and related structs.
---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2024-01-01 08:01:07 +03:00
ikafly144
d2fd4c5587
feat(ThreadMember): implement Member field (#1325)
* Add Member field to TreadMember

* Add query params to ThreadMember and ThreadMembers

* Add json tag

* docs: add periods

* fix: gofmt

* docs: document withMember parameter

* docs(Session.ThreadMember): rephrase description of withMember parameter

---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2023-12-23 06:44:08 +03:00
Elliot Williams
dde7690782
fix(GuildDelete)!: stop returning guild (#1329)
Stop returning Guild from GuildDelete, since underlying endpoint returns 204 (No Content).
2023-05-25 16:10:06 +03:00
Ishan Goel
7c47cfc906
fix(WebhookEditWithToken): error shadowing (#1372)
* fix(WebhookEditWithToken): error shadowing

* fix: gofmt

---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2023-05-11 17:43:05 +03:00
Yara McRobert
b7c431c368
Added stickers to type MessageSend (#1340)
* Added stickers to type MessageSend

* Update restapi.go

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

* Update message.go

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

---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2023-04-04 18:30:57 +03:00
Adam Snyder
58ea3535b0
fix: WithContext had no effect (#1337)
Fix usage of an outdated request in RequestWithLockedBucket after applying WithContext option

---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2023-03-10 02:13:09 +03:00
Fedor Lapshin
345a9d6466
Options (#1299)
* feat: add options for request methods

Add functional options to request, RequestWithBucketID, RequestWithLockedBucket.
These options allow for request modification and overriding REST related Session fields,
such as Client, MaxRestRetries and ShouldRetryOnRateLimit.

* feat: add context and retries options

Implement WithContext and WithMaxRestRetries options.

* feat: add documentation

Add documentation to the options

* feat(rest): add options to methods

Add option arguments to all Session methods.

* feat: add missed forwarded options

* feat: reword documentation

* refactor(requestConfig): rename to newRequestConfig

Rename requestConfig to newRequestConfig to match other
constructor functions naming.

* style: manually revert documentation formatting

Manually revert the formatting of documentation in certain functions.

* feat(UserChannelPermissions): add description of fetchOptions

Add description for fetchOptions parameter of Session.UserChannelPermissions.

* feat(ChannelMessageSendEmbedReply): pass options

Pass options to ChannelMessageSendEmbedsReply call in ChannelMessageSendEmbedReply

* docs(InviteComplex): revert parameter descriptions removal
2023-01-16 01:50:44 +03:00
Fedor Lapshin
4eef78e7e4
Role connections (#1295)
* feat: role connection metadata

* feat: add role connection endpoints

Add User Application Role Connection endpoints:
* Get User Application Role Connection
* Update User Application Role Connection

* feat: add example

Add basic example to showcase linked roles flow.

* refactor(endpoints): move role connection metadata

Move Application Role Connection Metadata endpoint to other Application
endpoints.
2022-12-26 02:31:49 +03:00
Dan Dryaev
410cf4fac5
Add files to MessageEdit (#1253)
* Add files to MessageEdit

* Remove files from json

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

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-10-07 14:47:55 +03:00
Fedor Lapshin
e57064892a
Forum channels (#1246)
* feat: forums

Initial implementation of forum channels REST API

* fix: linter

* feat: cosmetic changes

Added periods in the end of all documentation comments

* fix(ChannelFlagRequireTag): incorrect value

Fix incorrect value of ChannelFlagRequireTag.

* refactor(DefaultReaction): rename to ForumDefaultReaction

Rename DefaultReaction to ForumDefaultReaction.

* fix(Channel): use ForumDefaultReaction

Use ForumDefaultReaction instead of DefaultReaction in DefaultReactionEmoji field.

* fix: gofmt

* feat: cosmetic changes

* Change "GUILD_FORUM" to "forum" in comment to ForumTag
* Fix spacing for documentation of embeds parameter in ForumThreadStartEmbeds

* docs(ForumThreadStartComplex): align parameters

Align documentation for parameters of ForumThreadStartComplex.
2022-09-29 23:24:27 +03:00
Fedor Lapshin
622a7d8902
chore(GuildEdit)!: use a pointer for GuildParams (#1228) 2022-08-17 20:22:00 +03:00
Fedor Lapshin
576ecf0003
REST methods cleanup (#1217)
* refactor(GuildRoleEdit)!: use struct params

Refactor GuildRoleEdit to accept parameters using a Params struct.
Therefore also allow partial edits.

* feat(GuildRoleCreate): initial parameters

Make GuildRoleCreate accept a struct with initial parameters for a role

* refactor(ChannelEdit)!: replace ChannelEditComplex

Move funcitonality of ChannelEditComplex to ChannelEdit

* chore: deprecate ChannelEditComplex

* feat(GuildEmbed)!: allow partial edits

* Make fields omitempty
* Make `Enabled` field a pointer

* refactor(GuildEmbedEdit)!: use params struct

Refactor GuildEmbedEdit to accept parameters through GuildEmbed struct

* refactor(GuildMemberEdit)!: replace GuildMemberEditComplex

Move functionality fo GuildMemberEditComplex to GuildMemberEdit

* chore: deprecate GuildMemberEditComplex

* refactor(GuildEmojiCreate)!: use struct params

Refactor GuildEmojiCreate to take parameters using EmojiParams struct.

* refactor(GuildEmojiEdit)!: use struct params

Refactor GuildEmojiEdit to take parameters using EmojiParams struct.

* refactor(GuildMemberAdd)!: use struct params

Refactor GuildMemberAdd to take parameters using GuildMemberAddParams struct.

* refactor(GuildTemplateEdit)!: use struct params

Refactor GuildTemplateEdit to take parameters using GuildTemplateParams struct.

* refactor(GuildTemplateCreate)!: use struct params

Refactor GuildTemplateCreate to take parameters using GuildTemplateParams struct.

* chore(rest)!: use pointers for Params structs

Refactor methods with Params struct to use pointers

* chore: grammar and style fixes in comments
2022-08-17 18:41:11 +03:00
Dylan Lau
f7309cdb9e
feat: add UserGuildMember (#1210)
* feat(UserGuildMember): add UserGuildMember

* Update restapi.go

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

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-08-13 23:59:17 +03:00
Fedor Lapshin
4e021d9140
Auto moderation (#1201)
* feat: auto moderation

* feat(examples/automod): add message content intent

* style(examples/automod): newline between sections

* feat(AutoModerationActionExecution): add user id

Add user_id field to AutoModerationActionExecution event.

* refactor(events): remove todos

Remove TODO comments for AutoModerationRuleUpdate and AutoModerationRuleDelete.

* feat(AutoModerationEventMessageSend): doc comment

Add documentation comment to AutoModerationEventMessageSend constant.
2022-07-03 21:51:15 +03:00
plally
a7f0378623
add GET prefix for ApplicationCommands bucketID (#1193)
* add GET prefix for ApplicationCommands bucketID

* dont use local variable for bucketID

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

* format code

* remove newline

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-06-19 21:20:11 +03:00
Elias*
a7b7eaa2af
Use with_localizations flag (#1196)
* Improve support for application command localizations

Signed-off-by: GitHub <noreply@github.com>

* Remove query string from bucket name

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

* Fix formatting

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-06-19 18:43:00 +03:00
Andrey Dudin
e455362760
Add ability to reply with embeds (#1160)
* Add ability to reply with embeds

* Fix typo in method comment
2022-05-14 22:56:30 +03:00
Fedor Lapshin
9e0783c37f
Application commands: Permissions v2 (#1075)
* feat(interactions): default command permissions

* feat: add ApplicationCommandPermissionTypeChannel

* feat: add deprecation and oauth2 scope comments

* feat(interactions): add GuildAllChannelsID function

* feat(examples/slash_commands): application command permissions

* feat(events): add ApplicationCommandPermissionsUpdate

* feat: add AuditLogActionApplicationCommandPermissionUpdate

* feat(interactions#GuildAllChannelsID): use strconv instead of math/big

* feat(interactions#GuildAllChannelsID): error handling

* feat: cosmetic changes

* fix(examples/slash_commands): handle error returned by GuildAllChannelsID

* fix: typo

* fix: typo
2022-04-29 00:23:07 +03:00
Fedor Lapshin
9dc4ac5cac
Add InviteComplex (#1163)
* feat: implement InviteComplex

* fix: typo

* fix(rest#InviteComplex): guildScheduledEventID
2022-04-17 22:50:10 +03:00
Fedor Lapshin
eda859edc9
feat: custom JSON marshal/unmarshal functions (#1162) 2022-04-17 21:39:18 +03:00
Zander
24828068bc
Modify GuildEmojiEdit function of restapi.go (#1022)
* Modify GuildEmojiEdit function of restapi.go

Changes function to not omit empty role information. This allows for properly resetting the roles of an emoji, otherwise it appears to be presently impossible to reset the roles (without including a role ID in the edit request).

* feat: code review changes

* feat: fix typo and rephrase

Co-authored-by: nitroflap <fe.lap.prog@gmail.com>
2022-04-15 21:18:47 +03:00
42Atomys
8a126aa174
feat: Add support of Stage Instance REST API and Events (#1158)
* feat: Add support of StageInstance RESTAPI and Events

* chore: Make the changes for following the current convention of package

* doc: Add missing docs and example for stage-instance

* doc: Add final log for deleted stage instance

* refactor: Prevent trailing slash on stage instance endpoint

* chore: Harmonize params structure

* Update structs.go

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

* docs: Remove deprecated doc

* docs: Add new documentation for restapi function

* 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>

* Update restapi.go

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

* 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>

* doc: Add sleep in example to let user see by themselves

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-04-15 00:08:49 +03:00
Nick Hanley
c615fc7f19
Add option to disable rate-limited request retry (#1151)
* Add option to disable rate-limited request retry

Closes #1011.

* feat: code review changes

Co-authored-by: nitroflap <fe.lap.prog@gmail.com>
2022-04-14 22:35:06 +03:00
Dan Brakeley
2b359776da
fix error shadowing in InteractionRespond (#1030) 2022-04-14 22:30:21 +03:00
ToπSenpai
4d72c306b4
Add ApplicationID field to Interaction (#1125)
* add application_id to interaction struct and remove appID param from rest routes

* revert voice receive go mod & sum
2022-04-14 22:07:53 +03:00
Fedor Lapshin
7e04178d26
feat(rest): add GuildEmoji (#1153) 2022-04-10 19:53:52 +03:00
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