Module: Botiasloop::Commands

Defined in:
lib/botiasloop/commands.rb,
lib/botiasloop/commands/new.rb,
lib/botiasloop/commands/base.rb,
lib/botiasloop/commands/help.rb,
lib/botiasloop/commands/label.rb,
lib/botiasloop/commands/reset.rb,
lib/botiasloop/commands/status.rb,
lib/botiasloop/commands/switch.rb,
lib/botiasloop/commands/archive.rb,
lib/botiasloop/commands/compact.rb,
lib/botiasloop/commands/context.rb,
lib/botiasloop/commands/verbose.rb,
lib/botiasloop/commands/registry.rb,
lib/botiasloop/commands/conversations.rb,
lib/botiasloop/commands/system_prompt.rb

Overview

Slash commands module Provides a registry-based command system for bot control

Defined Under Namespace

Classes: Archive, Base, Compact, Context, Conversations, Help, Label, New, Registry, Reset, Status, Switch, SystemPrompt, Verbose

Class Method Summary collapse

Class Method Details

.command?(message) ⇒ Boolean

Check if a message is a command

Parameters:

  • message (String)

    Message to check

Returns:

  • (Boolean)

    True if message is a registered command



108
109
110
# File 'lib/botiasloop/commands/registry.rb', line 108

def self.command?(message)
  registry.command?(message)
end

.execute(message, context) ⇒ String

Execute a command from a message

Parameters:

  • message (String)

    Full command message

  • context (Context)

    Execution context

Returns:

  • (String)

    Command response or error message



117
118
119
# File 'lib/botiasloop/commands/registry.rb', line 117

def self.execute(message, context)
  registry.execute(message, context)
end

.registryRegistry

Singleton registry instance

Returns:

  • (Registry)

    The global command registry



100
101
102
# File 'lib/botiasloop/commands/registry.rb', line 100

def self.registry
  @registry ||= Registry.new
end