Project

kris

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
IRC bot library - Pluggable, and very simple
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Kris Stillmaintained

IRC bot library - Pluggable, and very simple

Gem Version Dependency Status Build Status Code Climate


Requirements

  • Ruby 1.9.3, 2.0.0

Getting started

Install the kris

RubyGems.org

gem install kris

Bundler

Edit a Gemfile

gem 'kris', :git => 'git://github.com/Tomohiro/kris.git'

Install

$ bundle install --path vendor/bundle

Bot project directory structure

my-bot-project
    |-- Gemfile
    |-- MyBot
    `-- plugin
        |-- reply.rb
        `-- hello.rb

Bootstrap Bot

$ vi my-bot-project/MyBot
#!/usr/bin/env ruby

require 'kris'

Kris::Session.new(
  server:   'chat.freenode.net',
  port:     6667,
  channel:  '#my-bot-channel',
  nickname: 'MyBot',
  username: 'MyBot',
  realname: 'MyBot',
  # Optional settings is below (Not Required)
  channels: %(#foo #bar #baz),  # If you want to join another channels with additional
  plugin_path: '/home/kris/my-bot-plugins'  # If you want to specify a defferent path
).start

Plugin example

Response

class Reply < Kris::Plugin
  def on_privmsg(message)
    case message.body.downcase
    when /hello/
      reply(message.to, message.from, 'Hello!')
    end
  end

  def on_topic(message)
    notice(message.to, "Now topic is #{message.body}")
  end
end

Scheduled notification

class Hello < Kris::Plugin
  def notify
    sleep 300
    notice('#notify-channel', 'Hello')
  end
end

Run

$ bundle exec ruby MyBot

LICENSE

© 2012 - 2013 Tomohiro TAIRA. This project is licensed under the MIT license. See LICENSE for details.