Skip to content

Commit

Permalink
address review
Browse files Browse the repository at this point in the history
  • Loading branch information
mlnrDev committed Apr 22, 2024
1 parent c51764a commit 6f85c0f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion discord/message_create.go
Expand Up @@ -18,7 +18,7 @@ type MessageCreate struct {
MessageReference *MessageReference `json:"message_reference,omitempty"`
Flags MessageFlags `json:"flags,omitempty"`
EnforceNonce bool `json:"enforce_nonce,omitempty"`
Poll PollCreate `json:"poll,omitempty"`
Poll *PollCreate `json:"poll,omitempty"`
}

func (MessageCreate) interactionCallbackData() {}
Expand Down
2 changes: 1 addition & 1 deletion discord/message_create_builder.go
Expand Up @@ -252,7 +252,7 @@ func (b *MessageCreateBuilder) SetSuppressEmbeds(suppressEmbeds bool) *MessageCr
}

// SetPoll sets the Poll of the Message
func (b *MessageCreateBuilder) SetPoll(poll PollCreate) *MessageCreateBuilder {
func (b *MessageCreateBuilder) SetPoll(poll *PollCreate) *MessageCreateBuilder {
b.Poll = poll
return b
}
Expand Down
2 changes: 1 addition & 1 deletion discord/webhook_message_create.go
Expand Up @@ -15,7 +15,7 @@ type WebhookMessageCreate struct {
Flags MessageFlags `json:"flags,omitempty"`
ThreadName string `json:"thread_name,omitempty"`
AppliedTags []snowflake.ID `json:"applied_tags,omitempty"`
Poll PollCreate `json:"poll,omitempty"`
Poll *PollCreate `json:"poll,omitempty"`
}

// ToBody returns the MessageCreate ready for body
Expand Down
2 changes: 1 addition & 1 deletion discord/webhook_message_create_builder.go
Expand Up @@ -211,7 +211,7 @@ func (b *WebhookMessageCreateBuilder) SetThreadName(threadName string) *WebhookM
}

// SetPoll sets the Poll of the webhook Message
func (b *WebhookMessageCreateBuilder) SetPoll(poll PollCreate) *WebhookMessageCreateBuilder {
func (b *WebhookMessageCreateBuilder) SetPoll(poll *PollCreate) *WebhookMessageCreateBuilder {
b.Poll = poll
return b
}
Expand Down
5 changes: 5 additions & 0 deletions events/guild_message_poll_events.go
Expand Up @@ -20,6 +20,11 @@ func (e *GenericGuildMessagePollVote) Guild() (discord.Guild, bool) {
return e.Client().Caches().Guild(e.GuildID)
}

// Channel returns the discord.GuildMessageChannel where the GenericGuildMessagePollVote happened
func (e *GenericGuildMessagePollVote) Channel() (discord.GuildMessageChannel, bool) {
return e.Client().Caches().GuildMessageChannel(e.ChannelID)
}

// GuildMessagePollVoteAdd indicates that a discord.User voted on a discord.Poll in a discord.Guild (requires gateway.IntentGuildMessagePolls)
type GuildMessagePollVoteAdd struct {
*GenericGuildMessagePollVote
Expand Down
8 changes: 4 additions & 4 deletions events/message_poll_events.go
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/disgoorg/snowflake/v2"
)

// GenericMessagePollVote is a generic poll vote event (requires gateway.IntentGuildMessagePolls or gateway.IntentDirectMessagePolls)
// GenericMessagePollVote is a generic poll vote event (requires gateway.IntentGuildMessagePolls and/or gateway.IntentDirectMessagePolls)
type GenericMessagePollVote struct {
*GenericEvent
UserID snowflake.ID
Expand All @@ -15,20 +15,20 @@ type GenericMessagePollVote struct {
AnswerID int
}

// Guild returns the discord.Guild where the GenericMessagePoll happened or empty if it happened in DMs
// Guild returns the discord.Guild where the GenericMessagePollVote happened or empty if it happened in DMs
func (e *GenericMessagePollVote) Guild() (discord.Guild, bool) {
if e.GuildID == nil {
return discord.Guild{}, false
}
return e.Client().Caches().Guild(*e.GuildID)
}

// MessagePollVoteAdd indicates that a discord.User voted on a discord.Poll (requires gateway.IntentGuildMessagePolls or gateway.IntentDirectMessagePolls)
// MessagePollVoteAdd indicates that a discord.User voted on a discord.Poll (requires gateway.IntentGuildMessagePolls and/or gateway.IntentDirectMessagePolls)
type MessagePollVoteAdd struct {
*GenericMessagePollVote
}

// MessagePollVoteRemove indicates that a discord.User removed their vote on a discord.Poll (requires gateway.IntentGuildMessagePolls or gateway.IntentDirectMessagePolls)
// MessagePollVoteRemove indicates that a discord.User removed their vote on a discord.Poll (requires gateway.IntentGuildMessagePolls and/or gateway.IntentDirectMessagePolls)
type MessagePollVoteRemove struct {
*GenericMessagePollVote
}
3 changes: 3 additions & 0 deletions gateway/gateway_intents.go
Expand Up @@ -54,6 +54,9 @@ const (
IntentDirectMessageTyping |
IntentDirectMessagePolls

IntentsMessagePolls = IntentGuildMessagePolls |
IntentDirectMessagePolls

IntentsNonPrivileged = IntentGuilds |
IntentGuildModeration |
IntentGuildEmojisAndStickers |
Expand Down

0 comments on commit 6f85c0f

Please sign in to comment.