mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-07 12:38:05 +00:00
Discord: typed snowflake for Interaction
This commit is contained in:
parent
65d7b8765b
commit
968112fb53
|
@ -34,7 +34,7 @@ type InteractionResponseData struct {
|
||||||
// RespondInteraction responds to an incoming interaction. It is also known as
|
// RespondInteraction responds to an incoming interaction. It is also known as
|
||||||
// an "interaction callback".
|
// an "interaction callback".
|
||||||
func (c *Client) RespondInteraction(
|
func (c *Client) RespondInteraction(
|
||||||
id discord.Snowflake, token string, data InteractionResponse) error {
|
id discord.InteractionID, token string, data InteractionResponse) error {
|
||||||
|
|
||||||
return c.FastRequest(
|
return c.FastRequest(
|
||||||
"POST",
|
"POST",
|
||||||
|
|
|
@ -193,6 +193,20 @@ func (s IntegrationID) Worker() uint8 { return Snowflake(s).Work
|
||||||
func (s IntegrationID) PID() uint8 { return Snowflake(s).PID() }
|
func (s IntegrationID) PID() uint8 { return Snowflake(s).PID() }
|
||||||
func (s IntegrationID) Increment() uint16 { return Snowflake(s).Increment() }
|
func (s IntegrationID) Increment() uint16 { return Snowflake(s).Increment() }
|
||||||
|
|
||||||
|
type InteractionID Snowflake
|
||||||
|
|
||||||
|
const NullInteractionID = InteractionID(NullSnowflake)
|
||||||
|
|
||||||
|
func (s InteractionID) MarshalJSON() ([]byte, error) { return Snowflake(s).MarshalJSON() }
|
||||||
|
func (s *InteractionID) UnmarshalJSON(v []byte) error { return (*Snowflake)(s).UnmarshalJSON(v) }
|
||||||
|
func (s InteractionID) String() string { return Snowflake(s).String() }
|
||||||
|
func (s InteractionID) IsValid() bool { return Snowflake(s).IsValid() }
|
||||||
|
func (s InteractionID) IsNull() bool { return Snowflake(s).IsNull() }
|
||||||
|
func (s InteractionID) Time() time.Time { return Snowflake(s).Time() }
|
||||||
|
func (s InteractionID) Worker() uint8 { return Snowflake(s).Worker() }
|
||||||
|
func (s InteractionID) PID() uint8 { return Snowflake(s).PID() }
|
||||||
|
func (s InteractionID) Increment() uint16 { return Snowflake(s).Increment() }
|
||||||
|
|
||||||
type GuildID Snowflake
|
type GuildID Snowflake
|
||||||
|
|
||||||
const NullGuildID = GuildID(NullSnowflake)
|
const NullGuildID = GuildID(NullSnowflake)
|
||||||
|
|
|
@ -371,14 +371,14 @@ type (
|
||||||
// https://discord.com/developers/docs/topics/gateway#interactions
|
// https://discord.com/developers/docs/topics/gateway#interactions
|
||||||
type (
|
type (
|
||||||
InteractionCreateEvent struct {
|
InteractionCreateEvent struct {
|
||||||
ID discord.Snowflake `json:"id"`
|
ID discord.InteractionID `json:"id"`
|
||||||
Type InteractionType `json:"type"`
|
Type InteractionType `json:"type"`
|
||||||
Data InteractionData `json:"data"`
|
Data InteractionData `json:"data"`
|
||||||
GuildID discord.GuildID `json:"guild_id"`
|
GuildID discord.GuildID `json:"guild_id"`
|
||||||
ChannelID discord.ChannelID `json:"channel_id"`
|
ChannelID discord.ChannelID `json:"channel_id"`
|
||||||
Member discord.Member `json:"member"`
|
Member discord.Member `json:"member"`
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
Version int `json:"version"`
|
Version int `json:"version"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type InteractionData struct {
|
type InteractionData struct {
|
||||||
ID discord.Snowflake `json:"id"`
|
ID discord.CommandID `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Options []InteractionOption `json:"options"`
|
Options []InteractionOption `json:"options"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue