Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't use soup.io when is there no soup file in muzang directory

  • Loading branch information...
commit 9f2c8f37d04b456579c05ad83fe6ba59084f1039 1 parent 69230f9
Piotr Niełacny authored
13 lib/muzang-plugins/muzang-meme.rb
View
@@ -19,7 +19,7 @@ class Meme
def initialize(bot)
@bot = bot
@matcher = Memetron::Matcher.new
- @soup = File.open(ENV["HOME"] + "/.muzang/" + "soup").read.split(":")
+ @soup = File.open(ENV["HOME"] + "/.muzang/" + "soup").read.split(":") rescue nil
end
def call(connection, message)
@@ -88,13 +88,14 @@ def create_instance(connection)
:text1 => @text1})
http.callback {
- puts "callback!"
meme = JSON.parse(http.response)
url = "http://version1.api.memegenerator.net#{meme['result']['instanceImageUrl']}"
- connection.msg("#{@bot.channels.first}", "Meme: #{url}")
- soup = Soup::Client.new(@soup.first, @soup.last.chomp)
- soup.login
- soup.new_image(url)
+ connection.msg("#{@bot.channels.first}", "Meme: #{url}")
+ if @soup
+ soup = Soup::Client.new(@soup.first, @soup.last.chomp)
+ soup.login
+ soup.new_image(url)
+ end
}
end
end
2  lib/muzang-plugins/version.rb
View
@@ -1,5 +1,5 @@
module Muzang
module Plugins
- VERSION = "1.1.2"
+ VERSION = "1.1.3"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.