Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Tiny IRC Bot framework
branch: master

Handle 433 raw automatically

latest commit e064b91d2c
Ryan Bigg authored
Failed to load latest commit information.
examples Add the light example
lib Handle 433 raw automatically
spec
.document Initial commit to summer2.
.gitignore Initial commit to summer2.
LICENSE Initial commit to summer2.
README.markdown add documentation for mode
Rakefile Remove dependency on jeweller
VERSION I consider Summer stable enough to be called a 1.0.
cleaner.rb Restructuring, removing of useless spaces.
summer.gemspec

README.markdown

Summer

Summer is an IRC Bot "framework" "inspired" by http://github.com/RISCFuture/autumn. Its goal is to be tiny.

Installation

The project is currently in "preview" state 'cause that's all the rage nowadays. No there's no invites, BUT everybody gets access to it. Sorry to inform you that you'll have to clone it and then run rake install if you want to use it.

Usage

To use summer, create a file like this:

require 'rubygems'
require 'summer'

class Bot < Summer::Connection

end

Bot.new("localhost")

Running it will make your bot attempt to connect to the server on localhost. For those of you who do not have an IRC server running locally, I would suggest trying irc.freenode.net instead.

Configuration

In the same directory create a directory called config and in that put summer.yml which can have the following keys:

  • nick: The nickname of the bot.
  • channel: A channel to join on startup.
  • channels: Channels to join on startup.
  • auto_rejoin: Set this to true if you want the bot to re-join any channel it's kicked from.
  • nickserv_password: Password to send to nickserv after connection but before joining any channels

did_start_up

Called when the bot has received the final MOTD line (376 or 422) and has finished joining all the channels.

channel_message(sender, channel, message)

Called when the bot receives a channel message.

  • sender (Hash): Contains nick and hostname
  • channel (String): The channel name: e.g. "#logga"
  • message (String): The message that was received

private_message(sender, bot, message)

Called when the bot receives a private message.

  • sender (Hash): Contains nick and hostname
  • bot (String): The bot's name.
  • message (String): The message that was received

join(sender, channel)

Called when the bot sees someone join a channel.

  • sender (Hash): Contains nick and hostname
  • channel (String): The channel name: e.g. "#logga"

part(sender, channel, message)

Called when someone parts a channel.

  • sender (Hash): Contains nick and hostname
  • channel (String): The channel name: e.g. "#logga"
  • message (String): The message that was received

quit(sender, message)

Called when someone quits the server.

  • sender (Hash): Contains nick and hostname
  • message (String): The message that was received.

kick(kicker, channel, victim, message)

Called when someone is kicked from a channel.

  • kicker (Hash): Contains nick and hostname
  • channel (String): The channel name: e.g. "#logga"
  • victim (String): Just the nick of whoever was kicked.
  • message (String): The message that was received.

mode(user, channel, mode, extra_parts)

Called when a mode in a channel changes.

  • User (Hash): Contains nick and hostname.
  • channel (String): The channel name: e.g. "#logga"
  • mode (String): The mode that was set/unset.
  • extra_parts (String): The extra parts after the mode set/unset (if any).

Handling raw messages

If you wish to handle raw messages that come into your bot you can define a handle_xxx method for that where xxx is the three-digit representation of the raw you wish to handle.

Something went wrong with that request. Please try again.