@@ -107,6 +107,48 @@ func (EventChannelDelete) eventData() {}
107
107
type EventThreadCreate struct {
108
108
discord.GuildThread
109
109
ThreadMember discord.ThreadMember `json:"thread_member"`
110
+ NewlyCreated bool `json:"newly_created"`
111
+ }
112
+
113
+ func (e * EventThreadCreate ) UnmarshalJSON (data []byte ) error {
114
+ var guildThread discord.GuildThread
115
+ if err := json .Unmarshal (data , & guildThread ); err != nil {
116
+ return err
117
+ }
118
+
119
+ e .GuildThread = guildThread
120
+
121
+ var v struct {
122
+ ThreadMember discord.ThreadMember `json:"thread_member"`
123
+ NewlyCreated bool `json:"newly_created"`
124
+ }
125
+ if err := json .Unmarshal (data , & v ); err != nil {
126
+ return err
127
+ }
128
+
129
+ e .ThreadMember = v .ThreadMember
130
+ e .NewlyCreated = v .NewlyCreated
131
+ return nil
132
+ }
133
+
134
+ func (e EventThreadCreate ) MarshalJSON () ([]byte , error ) {
135
+ data1 , err := json .Marshal (e .GuildThread )
136
+ if err != nil {
137
+ return nil , err
138
+ }
139
+
140
+ data2 , err := json .Marshal (struct {
141
+ ThreadMember discord.ThreadMember `json:"thread_member"`
142
+ NewlyCreated bool `json:"newly_created"`
143
+ }{
144
+ ThreadMember : e .ThreadMember ,
145
+ NewlyCreated : e .NewlyCreated ,
146
+ })
147
+ if err != nil {
148
+ return nil , err
149
+ }
150
+
151
+ return json .SimpleMerge (data1 , data2 )
110
152
}
111
153
112
154
func (EventThreadCreate ) messageData () {}
@@ -713,22 +755,41 @@ type EventIntegrationCreate struct {
713
755
}
714
756
715
757
func (e * EventIntegrationCreate ) UnmarshalJSON (data []byte ) error {
716
- type integrationCreateEvent EventIntegrationCreate
717
- var v struct {
718
- discord.UnmarshalIntegration
719
- integrationCreateEvent
758
+ var integration discord.UnmarshalIntegration
759
+ if err := json .Unmarshal (data , & integration ); err != nil {
760
+ return err
720
761
}
721
762
763
+ var v struct {
764
+ GuildID snowflake.ID `json:"guild_id"`
765
+ }
722
766
if err := json .Unmarshal (data , & v ); err != nil {
723
767
return err
724
768
}
725
769
726
- * e = EventIntegrationCreate (v .integrationCreateEvent )
727
-
728
- e .Integration = v .UnmarshalIntegration .Integration
770
+ e .Integration = integration .Integration
771
+ e .GuildID = v .GuildID
729
772
return nil
730
773
}
731
774
775
+ func (e EventIntegrationCreate ) MarshalJSON () ([]byte , error ) {
776
+ data1 , err := json .Marshal (e .Integration )
777
+ if err != nil {
778
+ return nil , err
779
+ }
780
+
781
+ data2 , err := json .Marshal (struct {
782
+ GuildID snowflake.ID `json:"guild_id"`
783
+ }{
784
+ GuildID : e .GuildID ,
785
+ })
786
+ if err != nil {
787
+ return nil , err
788
+ }
789
+
790
+ return json .SimpleMerge (data1 , data2 )
791
+ }
792
+
732
793
func (EventIntegrationCreate ) messageData () {}
733
794
func (EventIntegrationCreate ) eventData () {}
734
795
@@ -738,22 +799,41 @@ type EventIntegrationUpdate struct {
738
799
}
739
800
740
801
func (e * EventIntegrationUpdate ) UnmarshalJSON (data []byte ) error {
741
- type integrationUpdateEvent EventIntegrationUpdate
742
- var v struct {
743
- discord.UnmarshalIntegration
744
- integrationUpdateEvent
802
+ var integration discord.UnmarshalIntegration
803
+ if err := json .Unmarshal (data , & integration ); err != nil {
804
+ return err
745
805
}
746
806
807
+ var v struct {
808
+ GuildID snowflake.ID `json:"guild_id"`
809
+ }
747
810
if err := json .Unmarshal (data , & v ); err != nil {
748
811
return err
749
812
}
750
813
751
- * e = EventIntegrationUpdate (v .integrationUpdateEvent )
752
-
753
- e .Integration = v .UnmarshalIntegration .Integration
814
+ e .Integration = integration .Integration
815
+ e .GuildID = v .GuildID
754
816
return nil
755
817
}
756
818
819
+ func (e EventIntegrationUpdate ) MarshalJSON () ([]byte , error ) {
820
+ data1 , err := json .Marshal (e .Integration )
821
+ if err != nil {
822
+ return nil , err
823
+ }
824
+
825
+ data2 , err := json .Marshal (struct {
826
+ GuildID snowflake.ID `json:"guild_id"`
827
+ }{
828
+ GuildID : e .GuildID ,
829
+ })
830
+ if err != nil {
831
+ return nil , err
832
+ }
833
+
834
+ return json .SimpleMerge (data1 , data2 )
835
+ }
836
+
757
837
func (EventIntegrationUpdate ) messageData () {}
758
838
func (EventIntegrationUpdate ) eventData () {}
759
839
0 commit comments