Skip to content

Commit

Permalink
\!version
Browse files Browse the repository at this point in the history
  • Loading branch information
aktowns committed Jan 20, 2012
1 parent 73c50ef commit f66109f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mirai.rb
Expand Up @@ -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__))
Expand Down
6 changes: 6 additions & 0 deletions plugins/test-plugin/test.rb
Expand Up @@ -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)
Expand All @@ -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.