<commit_before># encoding: utf-8
# This file is part of the K5 bot project.
# See files README.md and COPYING for copyright and licensing information.

# Loader plugin loads or reloads plugins

require_relative '../IRCPlugin'

class Loader < IRCPlugin
	def on_privmsg(msg)
		return unless msg.tail
		case msg.botcommand
		when :load
			msg.tail.split.each do |name|
				@bot.pluginManager.unloadPlugin name
				if @bot.pluginManager.loadPlugin name
					msg.reply "'#{name}' loaded."
				else
					msg.reply "Cannot load '#{name}'."
				end
			end
		when :unload
			msg.tail.split.each do |name|
				if @bot.pluginManager.unloadPlugin name
					msg.reply "'#{name}' unloaded."
				else
					msg.reply "Cannot unload '#{name}'."
				end
			end
		end
	end

	def describe
		"Loads, reloads, and unloads plugins."
	end

	def commands
		{
			:load => "loads or reloads specified plugin",
			:unload => "unloads specified plugin"
		}
	end
end<commit_msg>Update loader plugin<commit_after># encoding: utf-8
# This file is part of the K5 bot project.
# See files README.md and COPYING for copyright and licensing information.

# Loader plugin loads or reloads plugins

require_relative '../IRCPlugin'

class Loader < IRCPlugin
	def on_privmsg(msg)
		case msg.botcommand
		when :load
			return unless msg.tail
			msg.tail.split.each do |name|
				@bot.pluginManager.unloadPlugin name
				if @bot.pluginManager.loadPlugin name
					msg.reply "'#{name}' loaded."
				else
					msg.reply "Cannot load '#{name}'."
				end
			end
		when :unload
			return unless msg.tail
			msg.tail.split.each do |name|
				if @bot.pluginManager.unloadPlugin name
					msg.reply "'#{name}' unloaded."
				else
					msg.reply "Cannot unload '#{name}'."
				end
			end
		when :reload_core
			load 'IRC/IRCBot.rb'
			load 'IRC/IRCChannel.rb'
			load 'IRC/IRCChannelManager.rb'
			load 'IRC/IRCFirstListener.rb'
			load 'IRC/IRCListener.rb'
			load 'IRC/IRCMessage.rb'
			load 'IRC/IRCMessageRouter.rb'
			load 'IRC/IRCPlugin.rb'
			load 'IRC/IRCPluginManager.rb'
			load 'IRC/IRCPrivate.rb'
			load 'IRC/IRCUser.rb'
			load 'IRC/IRCUserManager.rb'
			msg.reply "Core files reloaded."
		end
	end

	def describe
		"Loads, reloads, and unloads plugins."
	end

	def commands
		{
			:load => "loads or reloads specified plugin",
			:unload => "unloads specified plugin",
#			:reload_core => "reloads core files"
		}
	end
end
{'fraction_non_alphanumeric': 0.10687342833193629, 'fraction_numerical': 0.0016764459346186086, 'mean_word_length': 3.1155172413793104, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2090722', 'n_tokens_mistral': 969, 'n_tokens_neox': 825, 'n_words': 246}