Commit graph

1531 commits

Author SHA1 Message Date
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
ikafly144
0a42ffa9da
Add nsfw option (#1310) 2023-01-14 23:42:05 +03:00
ikafly144
ae8894be67
Add Forum settings to Channel struct (#1306)
* Add DefaultRateLimitPerUser DefaultSortOrder DefaultForumLayout to Channel struct

* Add prefix

* Add prefix

* Fix typo

* Fix field name typo

* Add to ChannelEdit struct

* Fix order and name

* Fix name

* Apply suggestions from code review

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

* feat: cosmetic changes

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2023-01-03 19:19:08 +03:00
ikafly144
2daab506b2
Add Presence ClientStatus (#1303)
* Add ClientStatus struct

* Add ClientStatus struct

* Add comment

* Update structs.go

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

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-12-29 20:52:07 +03:00
Yannis Matezki
f184824b8c
Provide previous Member state for GuildMemberUpdate events (#1304) 2022-12-27 21:23:54 +03:00
ikafly144
5e7e320c89
Automod trigger metadata update (#1305)
* Add AllowList and MentionTotalLimit

* Add pointer

* Fix
2022-12-27 21:14:29 +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
ikafly144
4074561d23
Add MessageComponentInteractionDataResolved struct (#1302) 2022-12-23 23:41:48 +03:00
Fedor Lapshin
8a5201aae6
feat(GuildParams): make PremiumProgressBarEnabled pointer
Make PremiumProgressBarEnabled field of GuildParams a pointer to allow
for the false value.
2022-12-17 23:16:09 +03:00
Fedor Lapshin
2a22f54711
fix: typo in system channel flag constants
Fix typo in names of SystemChannelFlagsSuppressGuildReminderNotifications and SystemChannelFlagsSuppressJoinNotificationReplies constants.
2022-12-17 23:08:14 +03:00
Ringo Hoffmann
e741fc2790
Complement GuildParams struct to comply with Discord's API (#1255)
* complement `GuildParams` struct [fix #994]

* fix: naming and spelling

* fix: gofmt

* refactor: use Locale type for PreferredLocale

Co-authored-by: zekro <private@zekro.de>
Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-12-17 23:03:18 +03:00
NonNonStop
9effc92908
Fix the problem of reconnecting when moved to another VC (#1271)
* Fix disconnection when moved to another VC

* Update voice.go

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

* Update voice.go

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

* Update voice.go

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

* feat: add VoiceServerUpdate todo

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-12-15 03:17:27 +03:00
Fedor Lapshin
b8188269f9
Auto populated select menus (#1269)
* feat(components): auto-populated selects

* Add component types for user, channel, role and mentionable selects
* Add MenuType field to SelectMenu for customization of select type
* Add basic example for auto-populated selects

* feat: implement SelectMenuType to restrict component types

Implement SelectMenuType to restrict component types that can be used
in MenuType field of SelectMenu structure.

* fix(SelectMenu): default type

Default to SelectMenuComponent type when MenuType is not specified.

* feat(examples/components): add ephemeral

Add ephemeral flag into response to match other component examples.

* feat(examples): option response and refactoring

* Add a response to the selected option.
* Refactor the command to match others.
* Remove showcase of multiple menu types.
2022-12-03 01:40:30 +03:00
Rick Staa
2998b2c67d
feat: add UpdateWatchStatus function (#1291)
This commit adds the UpdateWatchStatus method
2022-12-03 01:31:02 +03:00
Tony Krueger
f73d3a2fd5
removed os.Kill from caught signals in pingpoing, dm_pingpong and airhorn (#1281) 2022-11-23 23:26:25 +03:00
Jordhan Carvalho
128f34bee6
chore: replace dca-rs (#1240)
* chore: replace dca-rs

* Update examples/airhorn/README.md

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

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-11-19 19:16:23 +03:00
Fedor Lapshin
e580734d0b
Regex patterns automod rule trigger (#1275)
* feat: add regex pattern automod trigger

Add regex patterns metadata to AutoModerationTriggerMetadata.

* feat: add regex pattern example

Add showcase of regex filter into auto_moderation example.

* feat: cosmetic changes

Add period to the end of RegexPatterns documentation comment.
2022-11-17 00:57:13 +03:00
Fedor Lapshin
4ba7062176
Add README.md to all examples (#1236)
* feat(examples/*): add readme

Add README.md to all examples.

* fix(examples): logo image link

* fix(examples): add fixed width to logo

* feat(examples): add titles

* fix(examples/*): make logo smaller

Make DiscordGo logo smaller to match description and title in size.

* fix(examples/avatar): correct avatar url

Use correct logo URL in avatar URL image example.

* fix(examples/slash_commands): wording

Fix wording of "step-by-step tutorial" note.
2022-11-09 22:19:23 +03:00
Fedor Lapshin
fb0566fac2
fix(EmojiRegex): longer ids (#1274)
Fix EmojiRegex to accept emojis with ids up to 20 characters long
2022-11-08 23:30:53 +03:00
Andrew Garvin
f36b5430a8
docs(UpdateStatusData): fix a typo (#1276) 2022-11-08 23:20:35 +03:00
Fedor Lapshin
afab84009b
Add missing fields to Ready (#1227)
* feat(Ready): add shard and application fields

Add missing Shard and Application fields to Ready event struct.

* feat(Ready): make Shard pointer

Make Shard field pointer to be consistent with the API.
2022-10-24 02:03:26 +03:00
ozraru
0c2b0eccf4
Continue to next packet if received broken packet (#1260)
Broken packet should be ignored and continue to next packet.
This goroutine should not exit until close.
2022-10-24 01:44:08 +03:00
BunnyTheLifeguard
86539504d9
fix: remove embedfield omitempty (#1262)
Remove omitempty from Name/value since the Discord API requires both to be submitted.

Fixes: #726
2022-10-24 01:30:03 +03:00
ozraru
20aaca3b40
Overwrite entire emoji list on GuildEmojiUpdate (#1261)
* Overwrite entire emoji list on GuildEmojiUpdate

deleted emoji should be deleted from cache

* Updating GuildEmojis inline
2022-10-24 01:22:53 +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
1ff58d47ef
fix(MultipartBodyWithJSON): form file field name format (#1256) 2022-10-07 14:42:57 +03:00
Tsvetomir Bonev
bb321271cd
fix(structs): fix type of GuildScheduledEvent* enum values (#1254) 2022-10-07 14:41:27 +03:00
Nils Ponsard
bd58eb717e
fix(interactions): incorrect call of State.Role in RoleValue (#1237)
The gID parameter was passed to State.Role as roleID
and roleID was passed as guildID.
This commits inverts the arguments order to fix the issue.
2022-10-07 14:21:30 +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
fea3d77574
feat(*): bump version to 0.26.1 2022-08-29 18:10:38 +03:00
Fedor Lapshin
aa9af1488f
feat(*): bump version to 0.26.0 2022-08-17 20:56:19 +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
Fedor Lapshin
eee9bcb196
Remove remaining undocumented structs and fields (#1225)
* feat(events)!: drop undocumented structs and fields

* feat(structs)!: drop undocumented structs and fields

* fix(eventhandlers): regenerate event handling code

* fix(Ready): add PrivateChannels back
2022-08-17 17:50:21 +03:00
Fedor Lapshin
3cee831e8b
Add missing fields to GuildMemberParams (#1226)
* feat(GuildMemberParams): add missing fields

Add the following fields to GuildMemberParams
* channel_id

* mute

* deaf

* communication_disabled_until

* fix(GuildMemberParams): null values

Fix null values on omitted fields
2022-08-17 17:17:30 +03:00
Alfonso
73ebf67335
GuildFeatures added to UserGuild (#1223)
* GuildFeatures added to UserGuild

* Better comment phrasing

* Added GuildFeature type to Guild
2022-08-15 20:52:49 +03:00
Fedor Lapshin
7c87035a71
feat(voice): use Dialer for connections (#1220)
Use Session.Dialer for WebSocket connections.
2022-08-14 00:04:52 +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
Wynell
262e8ba52b
Add dialer property in config (#1179)
Co-authored-by: eeWynell <eewynell@gmail.com>
2022-08-13 23:42:42 +03:00
Corbett
c0803d021f
Add omitempty to channel_id in MessageReference struct (#1002) 2022-08-04 21:51:19 +03:00
Fedor Lapshin
f60fb54c52
feat: add contributing.md
Add CONTRIBUTING.md doc to set guidelines for new contributions.
2022-08-01 18:50:50 +03:00
David G
8b18bf4dc7
Allow setting bool properties of ChannelEdit to false (#1199)
Setting e.g. ChannelEdit.Archived = false is currently not possible
as go will treat a false as empty and will omit the property
from the JSON object.
2022-07-29 18:45:18 +03:00
plally
039e6855ed
fix typo in InviteTargetEmbeddedApplication and in some comments (#1211) 2022-07-29 18:42:40 +03:00
Fedor Lapshin
0feaae8f1b
feat(ApplicationCommandOption): min and max length (#1208)
Implement min_length and max_length for string option type.
2022-07-15 00:40:21 +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
Fedor Lapshin
f697ccae8c
feat(ApplicationCommand): guild id (#1207)
Add missing guild_id field to ApplicationCommand structure
2022-07-02 23:27:27 +03:00
Fedor Lapshin
033c07d89d
feat(interactions): application permissions (#1206) 2022-07-02 23:24:07 +03:00
Zachinquarantine
f446e069a1
Remove deprecated GuildChannel and PrivateChannel methods (#1203)
First deprecated in 2016 with #163
2022-07-01 00:49:29 +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
Riley
5da28ed4b9
Fix GuildTemplate struct and documentation (#1191)
* fix(structs.go): fix GuildTemplate struct and documentation

* revert(structs.go): change description from a string ptr to a string

* fix(structs.go): make name and description a pointer and omitempty

* fix(structs.go): made Name field not a string pointer. removed extra files

* fix(structs.go): fix Name field not having a type
2022-06-19 18:47:03 +03:00