Bot::BasicBot::Pluggalbe::WithConfig

CharsbotのYAMLロード部分を切り出して、Bot::BasicBot::PluggableのPluginをYAMLで読み込んで起動できるようにしたモジュールBot::BasicBot::Pluggalbe::WithConfigをリリースしました。

http://coderepos.org/share/browser/lang/perl/Charsbot/trunk

configurationは以下のように書きます。modulesには、Bot::BasicBot::Pluggable::Module:: のmodule名を書きます。

ex) mybot.yaml

server:   irc.example.net
port:     6667
nick:     pluggablebot
username: pluggablebot
charset:  utf-8
store:
  type:  Bot::BasicBot::Pluggable::Store::DBI
  dsn:   dbi:SQLite:sample.db
  table: sample
modules:
  - name: GoodBad 
  - name: Seen
  - name: Infobot
  - name: Title
channels:
  - #example

簡単なbot用のスクリプトもインストールするようにしています。以下のように実行できます。
http://search.cpan.org/dist/Bot-BasicBot-Pluggable-WithConfig-0.02/bin/bbpbot-config.pl

bbpbot-config.pl -c mybot.yaml

問い合わせて何か実行する系のbotBot::BasicBot::Pluggableのpluginを実装していく事で簡単に追加できるのでいいですね。

# Bot::BasicBot::Pluggableのほうでマージしてもらいたいところですが、活動としては止まってるみたいですね...