package modules;

import bot.IrcBot;
import bot.Message;
import bot.Module;
import bot.Modules;
import bot.config.Config;

public class Help implements Module {

	@Override
	public void parse(Message m) {
		String target = m.param();
		if(!m.param().startsWith("#")) target = m.sender();
		if(m.trailing().startsWith(".help") || m.botCommand().equals("help") || (m.param().equals(Config.getNick()) && m.trailing().toLowerCase().equals("help"))){
			String modules = "Modules: ";
			for(Module module : Modules.getModules()){
				modules += module.getClass().getSimpleName() + ", ";
			}
			modules = modules.substring(0, modules.length()-2);
			m.notice(m.sender(), modules);
			m.notice(m.sender(), "Commands can be found at https://github.com/wiiam/Personal-Bot/blob/master/COMMANDS.md");
			m.notice(m.sender(), "Source and license info can be found with .source and .license respectively");
			m.notice(m.sender(), "My commandchar is currently " + m.commandChar());
			m.notice(m.sender(), "If you want me to join a channel, use /invite " + Config.getNick());
		}
		if(m.trailing().startsWith(".source") || m.botCommand().equals("source") || (m.param().equals(Config.getNick()) && m.trailing().toLowerCase().equals("source"))){
			m.say(m.sender(), "https://github.com/wiiam/Personal-Bot");
		}
		if(m.trailing().startsWith(".license") || m.botCommand().equals("license") || (m.param().equals(Config.getNick()) && m.trailing().toLowerCase().equals("license"))){
			m.notice(m.sender(), "I am licensed under GNU AGPL. The terms of this license can be found here: https://github.com/wiiam/Personal-Bot/blob/master/LICENSE");
		}

	}

}

@@ -11,16 +11,43 @@
 dules;%0A%0A
+import java.util.HashMap;%0A%0A
 import b
@@ -506,103 +506,375 @@
 %0A%09%09%09
-for(Module module : Modules.getModules())%7B%0A%09%09%09%09modules += module.getClass().getSimpleName
+HashMap%3CString, String%3E map = Modules.getModuleStatuses();%0A%09%09%09for(HashMap.Entry%3CString, String%3E entry : map.entrySet())%7B%0A%09%09%09%09String color = %22%22;%0A%09%09%09%09if(entry.getValue().equals(%22loaded%22)) color = %22%032%22;%0A%09%09%09%09else if(entry.getValue().equals(%22unloaded%22)) color = %22%034%22;%0A%09%09%09%09else if(entry.getValue().equals(%22changed%22)) color = %22%037%22;%0A%09%09%09%09modules += color + entry.getKey
 () + %22
+%0F
 , %22;

use modules status function