Class: Discorb::Interaction
- Inherits:
-
DiscordModel
- Object
- DiscordModel
- Discorb::Interaction
- Defined in:
- lib/discorb/interaction/root.rb,
lib/discorb/interaction/response.rb
Overview
Represents a user interaction with the bot.
Direct Known Subclasses
AutoComplete, CommandInteraction, MessageComponentInteraction
Defined Under Namespace
Modules: SourceResponse, UpdateResponse
Instance Attribute Summary collapse
-
#application_id -> Discorb::Snowflake
readonly
The ID of the application that created the interaction.
-
#id -> Discorb::Snowflake
readonly
The ID of the interaction.
-
#member -> Discorb::Member
readonly
The member that created the interaction.
-
#token -> String
readonly
The token for the interaction.
-
#type -> Symbol
readonly
The type of interaction.
-
#user -> Discorb::User
readonly
The user that created the interaction.
-
#version -> Integer
readonly
The type of interaction.
Instance Method Summary collapse
- #channel -> Object
- #guild -> Object
- #inspect -> Object
- #target -> Object (also: #fired_by, #from)
Methods inherited from DiscordModel
Instance Attribute Details
#application_id -> Discorb::Snowflake (readonly)
Returns The ID of the application that created the interaction.
9 10 11 |
# File 'lib/discorb/interaction/root.rb', line 9 def application_id @application_id end |
#id -> Discorb::Snowflake (readonly)
Returns The ID of the interaction.
7 8 9 |
# File 'lib/discorb/interaction/root.rb', line 7 def id @id end |
#member -> Discorb::Member (readonly)
Returns The member that created the interaction.
13 14 15 |
# File 'lib/discorb/interaction/root.rb', line 13 def member @member end |
#token -> String (readonly)
Returns The token for the interaction.
20 21 22 |
# File 'lib/discorb/interaction/root.rb', line 20 def token @token end |
#type -> Symbol (readonly)
Returns The type of interaction.
11 12 13 |
# File 'lib/discorb/interaction/root.rb', line 11 def type @type end |
#user -> Discorb::User (readonly)
Returns The user that created the interaction.
15 16 17 |
# File 'lib/discorb/interaction/root.rb', line 15 def user @user end |
#version -> Integer (readonly)
Note:
This is always 1
for now.
Returns The type of interaction.
18 19 20 |
# File 'lib/discorb/interaction/root.rb', line 18 def version @version end |
Instance Method Details
#channel -> Object
56 57 58 |
# File 'lib/discorb/interaction/root.rb', line 56 def channel @client.channels[@channel_id] end |
#guild -> Object
52 53 54 |
# File 'lib/discorb/interaction/root.rb', line 52 def guild @client.guilds[@guild_id] end |
#inspect -> Object
67 68 69 |
# File 'lib/discorb/interaction/root.rb', line 67 def inspect "#<#{self.class} id=#{@id}>" end |
#target -> Object Also known as: fired_by, from
60 61 62 |
# File 'lib/discorb/interaction/root.rb', line 60 def target @member || @user end |