Class: Schatter::Command::ReplyToMessage
- Inherits:
-
Object
- Object
- Schatter::Command::ReplyToMessage
- Includes:
- Index
- Defined in:
- lib/schatter/command/reply_to_message.rb
Constant Summary
Constants included from Index
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#conversation ⇒ Object
readonly
Returns the value of attribute conversation.
-
#help ⇒ Object
readonly
Returns the value of attribute help.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #execute(text) ⇒ Object
-
#initialize(conversation, context) ⇒ ReplyToMessage
constructor
A new instance of ReplyToMessage.
Methods included from Index
Constructor Details
#initialize(conversation, context) ⇒ ReplyToMessage
Returns a new instance of ReplyToMessage.
8 9 10 11 12 13 |
# File 'lib/schatter/command/reply_to_message.rb', line 8 def initialize conversation, context @conversation = conversation @context = context @usage = '<index> <content>' @help = 'Replies to the specified message' end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/schatter/command/reply_to_message.rb', line 6 def context @context end |
#conversation ⇒ Object (readonly)
Returns the value of attribute conversation.
6 7 8 |
# File 'lib/schatter/command/reply_to_message.rb', line 6 def conversation @conversation end |
#help ⇒ Object (readonly)
Returns the value of attribute help.
6 7 8 |
# File 'lib/schatter/command/reply_to_message.rb', line 6 def help @help end |
#usage ⇒ Object (readonly)
Returns the value of attribute usage.
6 7 8 |
# File 'lib/schatter/command/reply_to_message.rb', line 6 def usage @usage end |
Instance Method Details
#execute(text) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/schatter/command/reply_to_message.rb', line 15 def execute text index, content = context.head_tail text = conversation..values[from_index(index)] unless puts "invalid index #{index}" return end conversation. content: content, parent_id: .uuid end |