Class: Discorb::Interaction

Inherits:
DiscordModel show all
Defined in:
lib/discorb/interaction/root.rb,
lib/discorb/interaction/response.rb

Overview

Represents an interaction of Discord.

Defined Under Namespace

Modules: ModalResponder, SourceResponder, UpdateResponder

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DiscordModel

#==, #eql?

Instance Attribute Details

#application_id -> Discorb::Snowflake (readonly)

Returns The ID of the application that created the interaction.

Returns:



10
11
12
# File 'lib/discorb/interaction/root.rb', line 10

def application_id
  @application_id
end

#guild_locale -> Symbol (readonly)

Note:

This modifies the language code, - will be replaced with _.

Returns The locale of the guild that created the interaction.

Returns:

  • (Symbol)

    The locale of the guild that created the interaction.



27
28
29
# File 'lib/discorb/interaction/root.rb', line 27

def guild_locale
  @guild_locale
end

#id -> Discorb::Snowflake (readonly)

Returns The ID of the interaction.

Returns:



8
9
10
# File 'lib/discorb/interaction/root.rb', line 8

def id
  @id
end

#locale -> Symbol (readonly)

Note:

This modifies the language code, - will be replaced with _.

Returns The locale of the user that created the interaction.

Returns:

  • (Symbol)

    The locale of the user that created the interaction.



24
25
26
# File 'lib/discorb/interaction/root.rb', line 24

def locale
  @locale
end

#member -> Discorb::Member (readonly)

Returns The member that created the interaction.

Returns:



14
15
16
# File 'lib/discorb/interaction/root.rb', line 14

def member
  @member
end

#token -> String (readonly)

Returns The token for the interaction.

Returns:

  • (String)

    The token for the interaction.



21
22
23
# File 'lib/discorb/interaction/root.rb', line 21

def token
  @token
end

#type -> Symbol (readonly)

Returns The type of interaction.

Returns:

  • (Symbol)

    The type of interaction.



12
13
14
# File 'lib/discorb/interaction/root.rb', line 12

def type
  @type
end

#user -> Discorb::User (readonly)

Returns The user that created the interaction.

Returns:



16
17
18
# File 'lib/discorb/interaction/root.rb', line 16

def user
  @user
end

#version -> Integer (readonly)

Note:

This is always 1 for now.

Returns The type of interaction.

Returns:

  • (Integer)

    The type of interaction.



19
20
21
# File 'lib/discorb/interaction/root.rb', line 19

def version
  @version
end

Instance Method Details

#channel -> Object



65
66
67
# File 'lib/discorb/interaction/root.rb', line 65

def channel
  @client.channels[@channel_id]
end

#guild -> Object



61
62
63
# File 'lib/discorb/interaction/root.rb', line 61

def guild
  @client.guilds[@guild_id]
end

#inspect -> Object



76
77
78
# File 'lib/discorb/interaction/root.rb', line 76

def inspect
  "#<#{self.class} id=#{@id}>"
end

#target -> Object Also known as: fired_by, from



69
70
71
# File 'lib/discorb/interaction/root.rb', line 69

def target
  @member || @user
end