Class: Elephrame::Bots::Command

Inherits:
BaseBot
  • Object
show all
Includes:
Command, Streaming
Defined in:
lib/elephrame/streaming/bots.rb

Overview

A bot that responds to commands,

after creation make sure to call add_command or else your bot won’t know what to respond to! (See [Elephrame::Command] for more details

Constant Summary

Constants inherited from BaseBot

BaseBot::FNGabLink, BaseBot::NoBotRegex

Instance Attribute Summary

Attributes included from Command

#cmd_hash, #cmd_regex, #commands, #not_found, #prefix

Attributes included from Reply

#on_reply

Attributes included from Streaming

#streamer

Attributes inherited from BaseBot

#client, #failed, #max_retries, #strip_html, #username

Instance Method Summary collapse

Methods included from Command

#add_command, #if_not_found, #run_commands, #set_help, #set_prefix, #setup_command

Methods included from Reply

#reply, #reply_with_mentions, #run_reply

Methods included from Streaming

#setup_streaming

Methods inherited from BaseBot

backup_method, #fetch_account_id, #fetch_list_id, #find_ancestor, #no_bot?, #post

Constructor Details

#initialize(prefix = '!', usage = nil) ⇒ Elephrame::Bots::Command

Create a new Command bot, sets commands and cmd_hash to empty defaults

Parameters:

  • prefix (String) (defaults to: '!')

    sets the command prefix, defaults to ‘!’

  • usage (String) (defaults to: nil)

    the response to the help command



62
63
64
65
66
67
# File 'lib/elephrame/streaming/bots.rb', line 62

def initialize prefix = '!', usage = nil
  super()
  
  setup_streaming
  setup_command prefix, usage
end