You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
454 B
Ruby
19 lines
454 B
Ruby
3 years ago
|
def reload_initialize(bot, bang)
|
||
|
bot.message(with_text: "#{bang}Reload") do |event|
|
||
|
reload(event)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def reload(event)
|
||
|
event.respond 'Reloading!'
|
||
|
File.foreach("modules/modules.txt", chop: true) { |line|
|
||
|
mod = "./modules/" + line + "/main.rb"
|
||
|
code = "defined? #{line.delete("\n")}_initialize"
|
||
|
if eval(code) == nil
|
||
|
load mod.delete("\n")
|
||
|
send("#{line.delete("\n")}_initialize", bot, bang)
|
||
|
else
|
||
|
load mod.delete("\n")
|
||
|
end
|
||
|
}
|
||
|
end
|