Commit graph

309 commits

Author SHA1 Message Date
Sentinel
cb59c78e32
Add size parameters to IconURL and BannerURL (#1301)
* Add missing parameters/structs

Adds guild icon size parameter, guild banner size parameter, missing ClientStatus struct

* Add missing endpoint for animated banners

* feat: revert ClientStatus changes

Revert addition of ClientStatus since another PR was already merged with
it.

* feat: add documentation for size parameter

* refactor: move icon url logic into separate func

Move logic for icon URLs in various functions into a single iconURL
function. Similar to banner and avatar functions.

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2023-01-18 01:59:00 +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
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
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
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
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
Tsvetomir Bonev
bb321271cd
fix(structs): fix type of GuildScheduledEvent* enum values (#1254) 2022-10-07 14:41:27 +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
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
Wynell
262e8ba52b
Add dialer property in config (#1179)
Co-authored-by: eeWynell <eewynell@gmail.com>
2022-08-13 23:42:42 +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
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
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
Aderlx
e030c5fff8
Add Invite ExpiresAt field (#1198) 2022-06-14 23:23:32 +03:00
Andre Cesar Gomes
c8c153872c
feat: add missing fields to VoiceState struct (#1190) 2022-06-03 15:58:53 +03:00
Christian Gärtner
466321bed6
fix: type of AuditLogActionApplicationCommandPermissionUpdate (#1177) 2022-05-06 23:25:57 +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
eda859edc9
feat: custom JSON marshal/unmarshal functions (#1162) 2022-04-17 21:39:18 +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
Rootspring
064fa164a0
Add guild NSFW level (#1029)
* Add guild NSFW level

* Fix typo

* fix(structs): typo

Co-authored-by: nitroflap <fe.lap.prog@gmail.com>
2022-04-10 23:41:53 +03:00
Fedor Lapshin
cff170546c
Fix RateLimitPerUser on ChannelEdit (#1152)
* fix ability to turn off slowmode via ChannelEdit

* fix(structs): gofmt

Co-authored-by: Cyrus <50967051+Not-Cyrus@users.noreply.github.com>
2022-04-10 18:36:05 +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
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
EvieDelta
dec22d7483
fix: add missing permission constants (#1144)
- UseActivities 0x8000000000
- ManageEvents 0x200000000
- UseExternalStickers 0x2000000000

Co-authored-by: EvieDelta <no public email>
2022-03-27 02:44:11 +03:00
Fedor Lapshin
0413c18206
Remove GuildSubscriptions field from Identify struct (#992)
Co-authored-by: rigormorrtiss <rigormorrtiss@gmail.com>
2022-03-23 21:50:47 +03:00
nitroflap
6cfbd16e1d
feat(structs): added ErrCodeMaximumGuildsReached back 2022-03-02 22:30:59 +03:00
Fedor Lapshin
4b615bec36
fix(structs): duplicated intents definition 2022-02-27 19:31:03 +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
nitroflap
5056d53d17 Revert "feat(structs#Session): made sessionID and sequence fields public"
This reverts commit 4390b565fa.
2022-02-27 18:11:50 +03:00
nitroflap
4390b565fa
feat(structs#Session): made sessionID and sequence fields public 2022-02-27 17:46:03 +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
Austin Alvarado
70e829694d
Add Invite Create/Delete (#1105)
* Add Invite Create/Delete

* rename const

* Refactor Application

* Feedback & deprecation

* lint fix for godoc comment

* review feedback
2022-02-26 00:13:27 +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
Flexolk
b7ce746717
Add get guild stickers support (#1095)
* Add get guild stickers support

* fix: change the type of Stickers of StickerPack to array pointer
2022-02-18 22:30:56 +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
nitroflap
e16b1f8e5b
fix(structs): added back old intent definitions for compatibility 2022-02-16 16:31:13 +03:00
Pedro Pessoa
c871464295
update intents (#1097) 2022-02-16 15:30:32 +03:00
Pedro Pessoa
115adf2866
add missing json error codes (#1096)
* add missing json error codes

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

* requested changes

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

* formatting

* add ErrCodeEmbedDisabled back

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2022-02-16 15:29:20 +03:00
nitroflap
5ee06354aa
fix: added AuditLogChangeKeyTempoary back for compatibility 2022-02-16 14:57:14 +03:00
Pedro Pessoa
c26bf45ce0
Update auditlog keys and actions (#1098)
* update audit log keys and actions

* remove unncessary tab

* move comments above

* feat: corrected comments for audit log change keys

* fix: typos in audit log change keys comments and definitions

Co-authored-by: nitroflap <fe.lap.prog@gmail.com>
2022-02-16 14:50:16 +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