Skip to content

Commit

Permalink
adds interactions create event
Browse files Browse the repository at this point in the history
  • Loading branch information
Seklfreak committed Jul 9, 2022
1 parent 39a8e9b commit 09b9f20
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions events/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type Event struct {
VoiceStateUpdate *discordgo.VoiceStateUpdate `json:"discord_voice_state_update,omitempty"`
VoiceServerUpdate *discordgo.VoiceServerUpdate `json:"discord_voice_server_update,omitempty"`
WebhooksUpdate *discordgo.WebhooksUpdate `json:"discord_webhooks_update,omitempty"`
InteractionCreate *discordgo.InteractionCreate `json:"discord_interaction_create,omitempty"`

// Cacophony Event Data
BucketUpdate *BucketUpdate `json:"cacophony_bucket_update,omitempty"`
Expand Down
6 changes: 6 additions & 0 deletions events/generating.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,12 @@ func GenerateEventFromDiscordgoEvent(
if err != nil {
return nil, expiration, err
}
case *discordgo.InteractionCreate:
event.Type = InteractionCreateType
event.InteractionCreate = t
event.GuildID = t.GuildID
event.ChannelID = t.ChannelID
event.CacheKey, err = hash(string(event.Type) + t.GuildID + t.ChannelID + t.Token)
case *discordgo.TypingStart, *discordgo.Ready, *discordgo.Event, *discordgo.Connect:
// ignored events
return nil, expiration, nil
Expand Down
1 change: 1 addition & 0 deletions events/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const (
VoiceStateUpdateType Type = "discord_voice_state_update"
VoiceServerUpdateType Type = "discord_voice_server_update"
WebhooksUpdateType Type = "discord_webhooks_update"
InteractionCreateType Type = "discord_interaction_create"
// Cacophony Events
CacophonyBucketUpdate Type = "cacophony_bucket_update"
CacophonyServerlistServerExpire Type = "cacophony_serverlist_server_expire"
Expand Down

0 comments on commit 09b9f20

Please sign in to comment.