Super simple IRCbot with plugins
mkdir muzang-instance
cd muzang-instance
bundle init
source "http://rubygems.org"
gem 'muzang'
# muzang.rb
require 'muzang'
EM.run do
@bot = Muzang::Bot.new(irc_host: 'localhost',
irc_port: 6667,
nick: 'muzang',
channels: ['#test'])
@bot.register_plugin(PluginClass)
@bot.start # start after register plugins
end
bundle exec ruby muzang.rb
class PluginName
def initialize(bot)
# initialize stuff
end
def call(connection, *message)
# plugin stuff
end
end
def call(connection, message)
- join(channel) join to channel
- part(channel) exit from the channel
- msg(channel, text) send message to channel or to user
def call(connection, message)
- numeric_reply
- nick who sent the message
- user
- host
- sever server from which the message was sent
- error
- channel channel from which the message was sent
- message message body
- command message command
- 1.9.2
- 1.9.3
- ruby-head
- rubinius 1.9 mode
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
- Fork the project
- Start a feature/bugfix branch
- Commit and push until you are happy with your contribution
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright (c) 2011 Piotr Niełacny. See LICENSE.txt for further details.