Home

Awesome

lita-irc

Gem Version Build Status

lita-irc is an adapter for Lita that allows you to use the robot with IRC.

Installation

Add lita-irc to your Lita instance's Gemfile:

gem "lita-irc"

Configuration

Required attributes

Optional attributes

Additional Cinch options

Under the hood, lita-irc uses Cinch for the IRC connection. Cinch has several configuration options that you may want to set. To do this, assign a proc/lambda to config.adapters.irc.cinch. lita-irc will yield the Cinch configuration object to the proc, so you can configure it as you'd like. Note that for the options listed in the sections above, those values will overwrite anything set in the proc.

Note: config.robot.name is used as Lita's IRC nickname. The nick attribute of the Cinch options is overwritten with this value.

config.robot.admins

Each IRC user has a unique ID that Lita generates and stores the first time that user is encountered. To populate the config.robot.admins attribute, you'll need to use these IDs for each user you want to mark as an administrator. If you're using Lita version 4.1 or greater, you can get a user's ID by sending Lita the command users find NICKNAME_OF_USER.

Example

Lita.configure do |config|
  config.robot.name = "Lita"
  config.robot.adapter = :irc
  config.robot.admins = ["eed844bf-2df0-4091-943a-7ee05ef36f4a"]
  config.adapters.irc.server = "irc.freenode.net"
  config.adapters.irc.channels = ["#litabot"]
  config.adapters.irc.user = "Lita"
  config.adapters.irc.realname = "Lita"
  config.adapters.irc.password = "secret"
  config.adapters.irc.cinch = lambda do |cinch_config|
    cinch_config.max_reconnect_delay = 123
  end
end

Events

The IRC adapter will trigger these events:

EventWhenPayload
:connectedconnected to IRCNone
:disconnecteddisconnected from IRCNone
:user_joined_rooma user joins a roomuser: Lita::User, room: Lita::Room
:user_parted_rooma user parts a roomuser: Lita::User, room: Lita::Room
:user_disconnecteda user disconnectsuser: Lita::User
:user_nick_changeda user changes nickuser: Lita::User, old_user: Lita::User

License

MIT