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