Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
bot
config
db
doc
public
script
test
.gitignore
README.markdown
Rakefile

README.markdown

Welcome to the BmoreOnRails IRC Bot Application

Required gems

  • shoulda

###Bot Deamon

  • percy
  • HTTParty - gem install httparty
  • JSON - gem install json

Rails App

  • will_paginate
  • sqlite3-ruby

Bot

Configuring

Create a config.yml in bot/config

It should look like this

bot:
  bot_name: 'bmorebottest'
  server: 'chat.us.freenode.net'
  channel: '#bmoreonrailstest'
  port: 6667

Starting

Run ruby bot/runner.rb

if you want to run it after you log out try the following

ruby bot/runner.rb > /dev/null &

Extending and contributing

Using the facade messaging system

This is an example of sending a message with a payload Facade[message, payload]

Facade[BotMessage:FOO, {:data => 'bar}]

This is an example of sending a single message without a payload Facade << message

Facade << BotMessage::DANCE

Mediators

Mediator: a negotiator who acts as a link between parties

Mediators must contain the two methods below and extend the Mediator class:

def commands
	[.. list of commands that this mediator handles ..]
end

def accepts
  []
end

def call(message, object)

end

See the MessageMediator for more examples

In order to use a new mediator you must register it in the bmore_bot.rb file

in MessageMediator#process_message an example of that function looks like this

def process_message(env)
  case env[:message]
    when FunMediator::DANCE_REGEXP
			#send message to fun mediator to send a dance to the channel
    when ServerMediator::QUIT_REGEXP
			#make the bot exit
    when /bmorebot/
			#give some info about the bot
  end
end

Running the bot tests

rake bot:units