Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/links.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# encoding: UTF-8
require 'addressable/uri'
require 'uri'

class Links < Linkbot::Plugin
Expand Down Expand Up @@ -31,7 +32,7 @@ def on_message(message, matches)
# So, split on the pipe and take the first thing until we get around to
# chopping up that regex
url = matches[0].split('|')[0]
url = URI.decode(url)
url = Addressable::URI.unescape(url)
uri = URI.parse(url)

# First, make sure this is a HTTP or HTTPS scheme
Expand Down
2 changes: 1 addition & 1 deletion plugins/urban.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def on_message(message, match)
word = Addressable::URI.escape(match[0])
doc = JSON.parse(http_get("http://www.urbandictionary.com/iphone/search/define?term=#{word}"))
if doc["result_type"] == "exact"
"\"#{URI.decode(word)}\": " + doc["list"][0]["definition"] + "\n" + "Example usage: " + doc["list"][0]["example"]
"\"#{Addressable::URI.unescape(word)}\": " + doc["list"][0]["definition"] + "\n" + "Example usage: " + doc["list"][0]["example"]
else
"No match!"
end
Expand Down
Loading