1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00
profanity/plugins/RubyTest.rb
2013-08-29 00:22:32 +01:00

51 lines
1.5 KiB
Ruby

module RubyTest
def self.prof_init(version, status)
Prof::cons_show("RubyTest: init, " + version + ", " + status)
Prof::register_command("/ruby", 0, 1, "/ruby", "RubyTest", "RubyTest", cmd_ruby)
Prof::register_timed(timer_test, 10)
end
def self.prof_on_start()
Prof::cons_show("RubyTest: on_start")
end
def self.prof_on_connect()
Prof::cons_show("RubyTest: on_connect")
end
def self.prof_on_message_received(jid, message)
Prof::cons_show("RubyTest: on_message_received, " + jid + ", " + message)
end
def self.cmd_ruby()
return Proc.new { | msg |
if msg
Prof::cons_show("RubyTest: /ruby command called, arg = " + msg)
else
Prof::cons_show("RubyTest: /ruby command called with no arg")
end
Prof::cons_alert
Prof::notify("RubyTest: notify", 2000, "Plugins")
Prof::send_line("/help")
Prof::cons_show("RubyTest: sent \"/help\" command")
}
end
def self.timer_test()
return Proc.new {
Prof::cons_show("RubyTest: timer fired.")
recipient = Prof::get_current_recipient
if recipient
Prof::cons_show(" current recipient = " + recipient)
end
Prof::cons_alert
}
end
def self.on_message_received(jid, message)
Prof::cons_show("RubyTest: on_message_received, jid = " + jid + ", message = " + message)
Prof::cons_alert
end
end