Class: Muzang::Plugins::LiveReload

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

Instance Method Summary collapse

Methods included from Helpers

#create_database, #match, #on_channel, #on_join

Constructor Details

#initialize(bot) ⇒ LiveReload

Returns a new instance of LiveReload.



6
7
8
# File 'lib/muzang-plugins/muzang-livereload.rb', line 6

def initialize(bot)
  @bot = bot
end

Instance Method Details

#call(connection, message) ⇒ Object



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

def call(connection, message)
  on_channel(message) do
    match(message, /^!reload$/) do
      @bot.plugins.each do |plugin, instance|
        Kernel.load("muzang-plugins/muzang-#{plugin.to_s.split("::").last.downcase}.rb")
        instance = plugin.new(@bot)
        connection.msg(message.channel, "Reloading: #{plugin}")
      end
    end
  end
end