Class: Botiasloop::Commands::Label

Inherits:
Base
  • Object
show all
Defined in:
lib/botiasloop/commands/label.rb

Overview

Label command - manages conversation labels

Instance Method Summary collapse

Methods inherited from Base

command, description, inherited

Instance Method Details

#execute(context, args = nil) ⇒ String

Execute the label command

Parameters:

  • context (Context)

    Execution context

  • args (String, nil) (defaults to: nil)

    Label value or nil to show current

Returns:

  • (String)

    Command response



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/botiasloop/commands/label.rb', line 15

def execute(context, args = nil)
  conversation = context.conversation

  if args.nil? || args.strip.empty?
    # Show current label
    return show_label(conversation)
  end

  # Set label
  label_value = args.strip
  set_label(conversation, label_value)
end