From b5ff36d68820f6de23a9c46a951f8c4597fedb1e Mon Sep 17 00:00:00 2001 From: "Robert \"ar\" Gerus" Date: Sun, 9 Jun 2013 16:45:30 +0200 Subject: [PATCH] Add a command for reloading commands. --- plugins/commands.rb | 12 ++++++++---- plugins/commands/reload.rb | 5 +++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 plugins/commands/reload.rb diff --git a/plugins/commands.rb b/plugins/commands.rb index 12350fb..a6143cd 100644 --- a/plugins/commands.rb +++ b/plugins/commands.rb @@ -24,12 +24,16 @@ class Repost 99 end + def reload_commands + self.commands = [] + Dir.glob(File.dirname($0) + "/plugins/commands/*.rb") { |filename| + load filename + } + end + end -# And here's where commands are actually loaded and registered -Dir.glob(File.dirname($0) + "/plugins/commands/*.rb") { |filename| - load filename -} +Client.reload_commands Client.register_trigger("PRIVMSG") { |msg| # who sent the message diff --git a/plugins/commands/reload.rb b/plugins/commands/reload.rb new file mode 100644 index 0000000..c67b0ab --- /dev/null +++ b/plugins/commands/reload.rb @@ -0,0 +1,5 @@ +Client.register_command("reload") { |args| + Client.reload_commands + + "commands reloaded..." +}