Class: Botiasloop::Commands::Context
- Inherits:
-
Object
- Object
- Botiasloop::Commands::Context
- Defined in:
- lib/botiasloop/commands/context.rb
Overview
Context object passed to command executions Provides access to conversation, chat, config, channel, and user info
Instance Attribute Summary collapse
-
#channel ⇒ Channels::Base?
readonly
The channel instance (nil in CLI).
-
#chat ⇒ Chat
readonly
The chat this conversation belongs to.
-
#conversation ⇒ Conversation
The current conversation.
-
#user_id ⇒ String?
readonly
The user/source identifier.
Instance Method Summary collapse
-
#initialize(conversation:, chat:, channel: nil, user_id: nil) ⇒ Context
constructor
Initialize context.
Constructor Details
#initialize(conversation:, chat:, channel: nil, user_id: nil) ⇒ Context
Initialize context
26 27 28 29 30 31 |
# File 'lib/botiasloop/commands/context.rb', line 26 def initialize(conversation:, chat:, channel: nil, user_id: nil) @conversation = conversation @chat = chat @channel = channel @user_id = user_id end |
Instance Attribute Details
#channel ⇒ Channels::Base? (readonly)
Returns The channel instance (nil in CLI).
15 16 17 |
# File 'lib/botiasloop/commands/context.rb', line 15 def channel @channel end |
#chat ⇒ Chat (readonly)
Returns The chat this conversation belongs to.
12 13 14 |
# File 'lib/botiasloop/commands/context.rb', line 12 def chat @chat end |
#conversation ⇒ Conversation
Returns The current conversation.
9 10 11 |
# File 'lib/botiasloop/commands/context.rb', line 9 def conversation @conversation end |
#user_id ⇒ String? (readonly)
Returns The user/source identifier.
18 19 20 |
# File 'lib/botiasloop/commands/context.rb', line 18 def user_id @user_id end |