Project

imouto

0.0
No commit activity in last 3 years
No release in over 3 years
A really basic & lightweight IRC-client-lib. Mix with a few lambdas for instant bot.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

imouto

A really basic & lightweight IRC-client-lib. Mix with a few λs for instant bot.

Functionality

Imouto is intended to be a base for IRC-bots. It doesn't do anything breathtaking, but also won't get in your way. Following that spirit, it isn't a complete implementation of the RFCs. It's easy to add commands though.

You can use only the IRC-client functionality and do whatever you like with the PRIVMSGs, or use the provided IRC-bot skeleton which provides:

  • Matchers: Execute λ for a given RegEx and reply with the result.
  • Rate Limiting: Most IRC-networks kick you if you send a lot of messages in too short a time, this avoids that.
  • Logging: Very basic interface to log stuff.

Installation

Imouto is a ruby gem. If you don't know how to install ruby gems, you should probably google it. Because it's a cool thing and you should know.

Examples

Using only the IRC-client functionality:

require "imouto"


config_connection = {
	'server' => 'futurelab.irc',
	'port' => 6667,
	'channels' => ['#future_lab'],
	'connect_timeout' => 10,
	'read_timeout' => 240,
}
config_user = {
	'nick' => 'parttimer',
	'username' => 'bicycle_master',
	'realname' => 'John Titor',
	'password' => 'elpsycongroo'
}

con = Imouto::Irc.new(config_connection, config_user)
con.start.read {|m|
	reply_to = m[:target].start_with?('#') ? m[:target] : m[:nick]
	con.privmsg(reply_to, m[:message])
}

Using Imouto with the included bot:

require "imouto"


config_connection = {
	'server' => 'futurelab.irc',
	'port' => 6667,
	'channels' => ['#future_lab'],
	'connect_timeout' => 10,
	'read_timeout' => 240,
}
config_user = {
	'nick' => 'parttimer',
	'username' => 'bicycle_master',
	'realname' => 'John Titor',
	'password' => elpsycongroo
}
config_imouto = {
	'message_interval_size' => 4,
	'messages_per_interval' => 3,
	'loggers' => [lambda {|msg| p msg}, SomethingCallable]	
}

con = Imouto::Irc.new(config_connection, config_user)
bot = Imouto::Bot.new(con, config_imouto)
bot.register_matcher(/foo (?<bar>.*)/, lambda {|msg|
	return "Answering PRIVMSG from #{msg.raw[:nick]}!#{msg.raw[:mask]}
		to msg.raw[:target] (captures: #{msg.captures[:bar]}"
})
bot.start()