1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-12-01 11:12:48 +00:00

Add TargetMessageID and TargetUserID convenience functions

This commit is contained in:
Vendicated 2022-07-05 15:01:23 +02:00 committed by diamondburned
parent fc2319e652
commit c1e8daec60

View file

@ -349,7 +349,9 @@ type CommandInteraction struct {
Options CommandInteractionOptions `json:"options"`
// GuildID is the id of the guild the command is registered to
GuildID GuildID `json:"guild_id,omitempty"`
// TargetID is the id of the user or message targeted by a user or message command
// TargetID is the id of the user or message targeted by a user or message command.
//
// See TargetUserID and TargetMessageID
TargetID Snowflake `json:"target_id,omitempty"`
Resolved struct {
// User contains user objects.
@ -374,6 +376,16 @@ func (*CommandInteraction) InteractionType() InteractionDataType {
return CommandInteractionType
}
// TargetUserID is the id of the user targeted by a user command
func (c *CommandInteraction) TargetUserID() UserID {
return UserID(c.TargetID)
}
// TargetMessageID is the id of the message targeted by a message command
func (c *CommandInteraction) TargetMessageID() MessageID {
return MessageID(c.TargetID)
}
func (*CommandInteraction) data() {}
// CommandInteractionOption is an option for a Command interaction response.