+ return _("Grouphug plugin. Confess! Usage: 'confess' for random confession, 'confess <number>' for specific one, 'confess <confession>' to share your own confession. Confessions must be at least 10 words.")
+ end
+
+ def post_confession(m, params)
+ c = params[:confession]
+ if c.length < 10
+ diff = 10 - c.length
+ m.reply _("Confession must be at least 10 words. You need %{m} more.") % {:m => diff}
+ return
+ end
+ uri = "http://beta.grouphug.us/confess"
+ form_id = "form_id=confession_node_form"
+ op = "op=Submit"
+ changed = "changed="
+ body = "body=#{c}"
+ msg = [form_id,body,changed,op].join("&")
+
+ response = bot.httputil.post(uri, msg)
+ debug response.body
+ if response.class == Net::HTTPOK
+ num = response.body.scan(REGPOST)
+ m.reply _("Confession posted: http://beta.grouphug.us/confessions/%{n}") % {:n => num}
+ else
+ m.reply _("I couldn't share your confession.")
+ end