6 # return a help string when the bot is asked for help on this plugin
7 def help(plugin, topic="")
8 return "rubyurl <your long url>"
11 # reply to a private message that we've registered for
14 # m.params contains the rest of the message, m.plugin contains the first
15 # word (useful because it's possible to register for multiple commands)
17 m.reply "incorrect usage. " + help(m.plugin)
20 # TODO: might want to add a check here to validate the url
21 # if they call 'rubyurl help' backwards, don't return a lame link
23 if (m.params == "help")
24 m.reply "Try again. Correct usage is: " + help(m.plugin)
28 # call the ShortURL library with the value of the url
29 url = ShortURL.shorten(m.params)
32 m.reply "Your RubyURL: #{url}"
37 # create an instance of the RubyURL class and register it as a plugin
39 rubyurl.register("rubyurl")