def self.get(count=1)
res = Net::HTTP.post_form(URI.parse(SITE), {'numwords' => count})
+ raise _("random word generator site failed with #{res.code} - #{res.message}") unless Net::HTTPSuccess === res
words = res.body.scan(%r{<a.*?\?w=(.*?)\n}).flatten
count == 1 ? words.first : words
def self.define(phrase)
raw = Net::HTTP.get(URI.parse(URL+CGI.escape(phrase)))
- res = raw.scan(REGEX).flatten.map { |e| e.strip }
+ res = raw.scan(REGEX).flatten.map { |e| e.ircify_html }
res.empty? ? false : res.last
end
target = if m.public?
m.channel
else
- params[:channel]
+ @bot.server.channel(params[:channel])
end
# is the bot on the channel?
- unless @bot.server.channels.names.include?(target.to_s)
+ unless @bot.myself.channels.include?(target)
m.reply _("i'm not on that channel")
return
end