Skip to content

yukidallas/aivisbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Aivis bot

A plugin-enable bot engine

Available

  • Slack bot engine
  • Twitter bot engine
  • Messenger bot engine
  • LINE bot engine

Installation

$ git clone git@github.com:yukidallas/aivisbot.git

Dependency

slack-ruby-client

$ gem install slack-ruby-client

Configuration

Add the path to LOAD_PATH for require files like ruby gem.

$LOAD_PATH.push('/path/to/aivisbot/lib')

require 'aivis'
require 'aivis/slack_bot'

Usage Examples (Slack bot)

More information on Wiki

Bot configuration

bot = Aivis::SlackBot::Reactor.new do |config|
  config.token = 'SLACK_BOT_TOKEN'
  config.bot_id = 'SLACK_BOT_ID'
end

bot.run

Command base plugin

class PingPlugin < Aivis::Plugin
  on :message do
    command 'ping' do |message|
      message.reply 'pong!'
    end
  end
end

Job base plugin

class TimeSignalPlugin
  every 1.hours do |time, account|
    account.web_client.chat_postMessage(
      channel: '#general', text: "#{time}"
    )
  end
end

Install plugin

bot.install_plugin(PingPlugin, JobPlugin)

More custimize

Catch exceptions

class MyBot < Aivis::SlackBot::Reactor
  def handle_exception(options = {})
    super
  rescue => e
    raise e
  end
end

Examples

https://github.com/yukidallas/aivisbot/tree/master/examples

About

A simple plugin-enable Ruby bot engine project (Available only Slack bot code)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages