A plugin-enable bot engine
- Slack bot engine
- Twitter bot engine
- Messenger bot engine
- LINE bot engine
$ git clone git@github.com:yukidallas/aivisbot.git
$ gem install slack-ruby-client
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'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.runCommand base plugin
class PingPlugin < Aivis::Plugin
on :message do
command 'ping' do |message|
message.reply 'pong!'
end
end
endJob base plugin
class TimeSignalPlugin
every 1.hours do |time, account|
account.web_client.chat_postMessage(
channel: '#general', text: "#{time}"
)
end
endInstall plugin
bot.install_plugin(PingPlugin, JobPlugin)Catch exceptions
class MyBot < Aivis::SlackBot::Reactor
def handle_exception(options = {})
super
rescue => e
raise e
end
end