Permalink
Browse files

\!version

  • Loading branch information...
1 parent 73c50ef commit f66109f6144b620bf6ede22802571d03d896f95a @aktowns committed Jan 20, 2012
Showing with 10 additions and 0 deletions.
  1. +4 −0 mirai.rb
  2. +6 −0 plugins/test-plugin/test.rb
View
@@ -45,6 +45,10 @@ def check_data
end
@buffer = @buffer[tmp..-1]
end
+
+ def self.version
+ "Mirai Git: #{`git log --pretty=oneline | head -n 1`.strip}"
+ end
end
Dir.chdir(File.dirname(__FILE__))
@@ -2,7 +2,9 @@ class TestPlugin < Mirai::Plugin
def on_register
add_channel_handler(/test/, :test_handler) # Trigger is assumed as default
add_channel_handler(/crash/, :crash_handler)
+ add_channel_handler(/version/, :version_handler)
add_web_handler(/testing/, :test_web_handler)
+
end
def test_handler(info)
@@ -19,4 +21,8 @@ def crash_handler(info)
msg info[:chan], "Forcing plugin to crash"
bob!
end
+
+ def version_handler(info)
+ msg info[:chan], Mirai::version()
+ end
end

0 comments on commit f66109f

Please sign in to comment.