-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
175 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package discord | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/disgoorg/snowflake/v2" | ||
) | ||
|
||
type Poll struct { | ||
Question PollMedia `json:"question"` | ||
Answers []PollAnswer `json:"answers"` | ||
Expiry time.Time `json:"expiry"` | ||
AllowMultiselect bool `json:"allow_multiselect"` | ||
LayoutType PollLayoutType `json:"layout_type"` | ||
Results []PollResults `json:"results"` | ||
} | ||
|
||
type PollMedia struct { | ||
Text *string `json:"text"` | ||
Emoji *PartialEmoji `json:"emoji"` | ||
} | ||
|
||
type PollAnswer struct { | ||
AnswerID *snowflake.ID `json:"answer_id"` | ||
PollMedia PollMedia `json:"poll_media"` | ||
} | ||
|
||
type PollResults struct { | ||
IsFinalized bool `json:"is_finalized"` | ||
AnswerCounts []PollAnswerCount `json:"answer_counts"` | ||
} | ||
|
||
type PollAnswerCount struct { | ||
ID snowflake.ID `json:"id"` | ||
Count int `json:"count"` | ||
MeVoted bool `json:"me_voted"` | ||
} | ||
|
||
type PollLayoutType int | ||
|
||
const ( | ||
PollLayoutTypeDefault PollLayoutType = iota + 1 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package handlers | ||
|
||
import ( | ||
"github.com/disgoorg/disgo/bot" | ||
"github.com/disgoorg/disgo/events" | ||
"github.com/disgoorg/disgo/gateway" | ||
) | ||
|
||
func gatewayHandlerMessagePollVoteAdd(client bot.Client, sequenceNumber int, shardID int, event gateway.EventMessagePollVoteAdd) { | ||
client.EventManager().DispatchEvent(&events.MessagePollVoteAdd{ | ||
GenericMessagePoll: &events.GenericMessagePoll{ | ||
GenericEvent: events.NewGenericEvent(client, sequenceNumber, shardID), | ||
UserID: event.UserID, | ||
ChannelID: event.ChannelID, | ||
MessageID: event.MessageID, | ||
GuildID: event.GuildID, | ||
AnswerID: event.AnswerID, | ||
}, | ||
}) | ||
} | ||
|
||
func gatewayHandlerMessagePollVoteRemove(client bot.Client, sequenceNumber int, shardID int, event gateway.EventMessagePollVoteRemove) { | ||
client.EventManager().DispatchEvent(&events.MessagePollVoteRemove{ | ||
GenericMessagePoll: &events.GenericMessagePoll{ | ||
GenericEvent: events.NewGenericEvent(client, sequenceNumber, shardID), | ||
UserID: event.UserID, | ||
ChannelID: event.ChannelID, | ||
MessageID: event.MessageID, | ||
GuildID: event.GuildID, | ||
AnswerID: event.AnswerID, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters