From e633d656e00fdac51f077eff827518848235e916 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 17 Aug 2014 23:31:45 -0700 Subject: Initial commit. --- example.rb | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 example.rb (limited to 'example.rb') diff --git a/example.rb b/example.rb new file mode 100644 index 0000000..cd09859 --- /dev/null +++ b/example.rb @@ -0,0 +1,45 @@ +require_relative 'bocelli' + +module Bocelli::Module::Foo + extend Bocelli::Module::Base + + on 'test' do + out 'this is a test!' + end + + on /^foo/ do + out 'foo' * (rand(5) + 1) + end +end + +module Bocelli::Module::Bar + extend Bocelli::Module::Base + + on /^bar+$/ do + out 'bar' * (rand(5) + 1) + end + + on /^baz+$/i do + out 'baz' * (rand(5) + 1) + end +end + +class TestBot < Bocelli::Base + register Bocelli::Module::Foo + register Bocelli::Module::Bar + + on 'rand' do + out rand(100) + end + + on 'current' do + out '%s %s' % [@bocelli[:str].inspect, @bocelli[:route].inspect] + end +end + +TestBot.configure('chat.freenode.net', 6667, 'bocelli%03d' % rand(1000)) +TestBot.connect do + join '##omp' +end + +TestBot.run -- cgit v1.2.3-70-g09d2