<commit_before>package processing.command;

import java.util.concurrent.BlockingQueue;

import logger.Logger;
import messaging.OutgoingMessage;
import messaging.OutgoingMessage.OutType;
import processing.CommandBase;
import users.PermissionClass;

public class CommandCommandView extends CommandBase {

	@Override
	public boolean isMatch() {
		
		if (!getToken("alias").startsWith(":"))	return false;
									return true;
	}

	@Override
	public boolean isValid(BlockingQueue<OutgoingMessage> listOut) {
		
		String command = ((ProcCommand)parent).getCommand(getToken("alias").substring(1), getUser());
		
		if (command != null && command != "") 	return true;		
												return false;
		
		
	}

	@Override
	public boolean execute(BlockingQueue<OutgoingMessage> listOut) {
		
		String commandStr = ((ProcCommand)parent).getCommand(getToken("alias").substring(1), getUser());
		
		commandStr = commandStr.replaceAll("%me", getUser());
		return listOut.add(new OutgoingMessage(OutType.CHAT, commandStr, parent.channel));
		
	}

	@Override public String getPermissionString() 			{ return "command.view"; }
	@Override public PermissionClass getPermissionClass() 	{ return PermissionClass.User; }
	@Override public String getFormatString() 				{ return ":<alias>"; }
	@Override public String getHelpString() 				{ return "This command views the response <alias>"; }
	
}<commit_msg>Readding %arg<n> parsing for kcommand<commit_after>package processing.command;

import java.util.concurrent.BlockingQueue;

import logger.Logger;
import messaging.OutgoingMessage;
import messaging.OutgoingMessage.OutType;
import processing.CommandBase;
import users.PermissionClass;

public class CommandCommandView extends CommandBase {

	@Override
	public boolean isMatch() {
		
		if (!getToken("alias").startsWith(":"))	return false;
									return true;
	}

	@Override
	public boolean isValid(BlockingQueue<OutgoingMessage> listOut) {
		
		String command = ((ProcCommand)parent).getCommand(getToken("alias").substring(1), getUser());
		
		if (command != null && command != "") 	return true;		
												return false;
		
		
	}

	@Override
	public boolean execute(BlockingQueue<OutgoingMessage> listOut) {
		
		String commandStr = ((ProcCommand)parent).getCommand(getToken("alias").substring(1), getUser());
		
		String[] args = getToken("...").split(" ");
		String[] commandSplitStr = commandStr.split("");
		
		for (String t : commandSplitStr) {
			if (t.contains("%arg")) {
				for (int argCounter = 1; argCounter < args.length; argCounter++) {
					t = t.replace("%arg" + argCounter, args[argCounter]);
				}
				if (t.contains("%arg")) {
					t = "";
				}
			}
		}
		
		commandStr = commandStr.replaceAll("%me", getUser());
		
		return listOut.add(new OutgoingMessage(OutType.CHAT, commandStr, parent.channel));
		
	}

	@Override public String getPermissionString() 			{ return "command.view"; }
	@Override public PermissionClass getPermissionClass() 	{ return PermissionClass.User; }
	@Override public String getFormatString() 				{ return ":<alias> ..."; }
	@Override public String getHelpString() 				{ return "This command views the response <alias>"; }
	
}
{'fraction_non_alphanumeric': 0.13047619047619047, 'fraction_numerical': 0.0015873015873015873, 'mean_word_length': 4.537785588752197, 'pattern_counts': {'":': 4, '<': 13, '<?xml version=': 0, '>': 12, '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': '7051016', 'n_tokens_mistral': 1045, 'n_tokens_neox': 886, 'n_words': 214}