aboutsummaryrefslogtreecommitdiffstats
path: root/core/plugin/template
blob: 5c8dac7d2b8b10ea131e276a98f587e6c03de4f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#
# プラグインテンプレート
#

# これを基にプラグインを作って行く
# 別にこれを基にしなくてもいい
# 以下、MyPluginプラグインを作る例

require 'utils'
require 'plugin/plugin'

module Plugin
  class MyPlugin < Plugin

    # 毎分のイベントハンドラ
    def onperiod(watch)
      return watch.post(Message.new('hello, MyPlugin!', [self.name]))
    end

    def oncall(watch, message, tag)
      return watch.post(Message.new("called by you", [self.name], message))
    end
  end

end

# プラグインの登録
Plugin::Ring.push Plugin::MyPlugin.new,[:period, :call]