Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Guild Scheduled Event Support #1032

Merged
merged 52 commits into from Feb 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2b3d018
Add Guild Scheduled Events support
42atomys Nov 20, 2021
84aaa03
Add missing Indents for Guild Scheduled Events
42atomys Nov 20, 2021
677fcc2
Merge remote-tracking branch 'upstream/master'
42atomys Feb 18, 2022
1bcc001
fix: Do update from new schedules updates and repository updates
42atomys Feb 18, 2022
6554e26
doc: Add missing documentation on const
42atomys Feb 18, 2022
260e8ca
doc: Add missing documentation on events struct
42atomys Feb 18, 2022
d7dc906
tests: Add a Skip condition when dgBot is not set to prevent segfault
42atomys Feb 18, 2022
1359c13
fix: Resolve merge conflicts
42atomys Feb 21, 2022
b08a6e3
fix: Somes changes following the last review steps
42atomys Feb 22, 2022
5fa6423
docs: Add an example to manipulate GuildScheduledEvent
42atomys Feb 22, 2022
90751ec
clean: Remove useless pointers on struct used to retrieve data
42atomys Feb 22, 2022
2aef679
tests: Test extra query params on GuildScheduledEventUsers requests
42atomys Feb 22, 2022
78676f4
clean: Remove unused variables
42atomys Feb 22, 2022
ea5dc9a
feat: Add nullable types to provide null value to Discord API when is…
42atomys Feb 23, 2022
4498cb6
feat: Use NullableString in ScheduledEvents
42atomys Feb 23, 2022
e02240e
docs: Add example for usage of NullableString
42atomys Feb 23, 2022
f5cac02
Merge branch 'bwmarrin:master' into master
42atomys Feb 23, 2022
64f87b7
upstream: Update upstream
42atomys Feb 27, 2022
d15da2a
Update structs.go
42atomys Feb 27, 2022
ad67d7d
Update restapi.go
42atomys Feb 27, 2022
88aa388
fix: Review changes to move back nullable string into a simple Marsha…
42atomys Feb 27, 2022
92e6ce3
Merge branch 'master' of github.com:41Atomys/discordgo
42atomys Feb 27, 2022
e4df643
fix: Remove NullString on tests and examples
42atomys Feb 27, 2022
3a971f7
doc: Add missing doc
42atomys Feb 27, 2022
1fe6066
Update structs.go
42atomys Feb 27, 2022
f52727a
Merge branch 'master' of github.com:42Atomys/discordgo
42atomys Feb 27, 2022
795cd27
fix: misunderstood MarhsalJSON
42atomys Feb 27, 2022
5bbf72e
fix: Follow the convention of discordgo on url.Values
42atomys Feb 27, 2022
d8ab9d9
Update examples/scheduled_events/main.go
42atomys Feb 27, 2022
1176142
changes: use conditional instead on Sprintf
42atomys Feb 27, 2022
a905f17
fix: Add missing status on Params
42atomys Feb 27, 2022
e9a2fe1
Update structs.go
42atomys Feb 27, 2022
fae5682
Update structs.go
42atomys Feb 27, 2022
ee6b0ea
changes: Move flag.Parse inside the init function
42atomys Feb 27, 2022
be01232
fix: remove null statement of test suite
42atomys Feb 27, 2022
6b3074d
fix: Rewrite Marshal of GuildScheduledEventParams to prevent a stack …
42atomys Feb 27, 2022
5f37849
clean: Remove unused Intents
42atomys Feb 27, 2022
b289ecd
Update restapi.go
42atomys Feb 27, 2022
f82eff0
Update restapi.go
42atomys Feb 27, 2022
b542383
Update restapi.go
42atomys Feb 27, 2022
45008f8
doc: polish the documentation
42atomys Feb 27, 2022
35ffaad
Merge branch 'master' of github.com:42Atomys/discordgo
42atomys Feb 27, 2022
0a42322
clean: Final polish code
42atomys Feb 27, 2022
35c4db9
doc: Add information about 1:1 usage
42atomys Feb 27, 2022
4e0be03
Update discord_test.go
42atomys Feb 27, 2022
204b188
doc: remove unnecessary additional infos
42atomys Feb 27, 2022
2b67cfb
Update structs.go
42atomys Feb 27, 2022
675c43b
Update discord_test.go
42atomys Feb 27, 2022
c1dc39a
Update restapi.go
42atomys Feb 27, 2022
b62a67a
chore(examples/scheduled_events): removed NullString comment
FedorLap2006 Feb 27, 2022
dcc7444
fix(structs): grammar in comment to EntityType
FedorLap2006 Feb 27, 2022
a1e0044
fix: run gofmt
42atomys Feb 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions discord_test.go
Expand Up @@ -277,8 +277,6 @@ func TestComplexScheduledEvents(t *testing.T) {
}
defer dgBot.GuildScheduledEventDelete(envGuild, event.ID)

time.Sleep(4 * time.Second)

_, err = dgBot.GuildScheduledEventEdit(envGuild, event.ID, &GuildScheduledEventParams{
EntityType: GuildScheduledEventEntityTypeExternal,
EntityMetadata: &GuildScheduledEventEntityMetadata{
Expand Down
15 changes: 12 additions & 3 deletions structs.go
Expand Up @@ -839,14 +839,23 @@ type GuildScheduledEventParams struct {
// GuildScheduledEventParams to handle the special case of a null value
// for channel_id field
func (p *GuildScheduledEventParams) MarshalJSON() ([]byte, error) {
42atomys marked this conversation as resolved.
Show resolved Hide resolved
type guildScheduledEventParams GuildScheduledEventParams

if p.EntityType == GuildScheduledEventEntityTypeExternal && p.ChannelID == "" {
return json.Marshal(struct {
*GuildScheduledEventParams
guildScheduledEventParams
ChannelID json.RawMessage `json:"channel_id"`
}{GuildScheduledEventParams: p, ChannelID: json.RawMessage("null")})
}{
guildScheduledEventParams: guildScheduledEventParams(*p),
ChannelID: json.RawMessage("null"),
})
}

return json.Marshal(p)
return json.Marshal(struct {
guildScheduledEventParams
}{
guildScheduledEventParams: guildScheduledEventParams(*p),
})
}
42atomys marked this conversation as resolved.
Show resolved Hide resolved

// GuildScheduledEventEntityMetadata holds additional metadata for guild scheduled event.
Expand Down