Class: Muzang::Plugins::SoupIRC

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/muzang-plugins/muzang-soupirc.rb

Instance Method Summary collapse

Methods included from Helpers

#create_database, #match, #on_channel, #on_join

Constructor Details

#initialize(bot, soup = nil) ⇒ SoupIRC

Returns a new instance of SoupIRC.



8
9
10
11
# File 'lib/muzang-plugins/muzang-soupirc.rb', line 8

def initialize(bot, soup=nil)
  @bot  = bot
  @soup = soup || File.open(ENV["HOME"] + "/.muzang/" + "soup").read.split(":") rescue nil
end

Instance Method Details

#call(connection, message) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/muzang-plugins/muzang-soupirc.rb', line 13

def call(connection, message)
  message.message.match(/^!soup (.*?)$/) do |m|
    soup = Soup::Client.new(@soup.first, @soup.last.chomp)
    soup.
    soup.new_image(m[1])
    connection.msg(@bot.channels.first, "soup updated :) | http://#{@soup.first}.soup.io/")
  end
end