class Discorb::Message::Interaction

Represents a interaction of message.

Attributes

id[R]

@return [Discorb::Snowflake] The user ID.

name[R]

@return [String] The name of command. @return [nil] If the message is not a command.

type[R]

@return [Class] The type of interaction.

user[R]

@return [Discorb::User] The user.

Public Class Methods

new(client, data) click to toggle source

@!visibility private

# File lib/discorb/message.rb, line 571
def initialize(client, data)
  @id = Snowflake.new(data[:id])
  @name = data[:name]
  @type = Discorb::Interaction.descendants.find { |c| c.interaction_type == data[:type] }
  @user = client.users[data[:user][:id]] || User.new(client, data[:user])
end