<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.techcavern.wavetact.utils.objects;

import com.techcavern.wavetact.utils.GeneralRegistry;
import com.techcavern.wavetact.utils.GeneralUtils;
import com.techcavern.wavetact.utils.IRCUtils;
import org.apache.commons.lang3.StringUtils;
import org.pircbotx.Channel;
import org.pircbotx.PircBotX;
import org.pircbotx.User;
import org.pircbotx.hooks.events.MessageEvent;

/**
 * @author jztech101
 */
public class SimpleMessage extends GenericCommand {

    private final String message;
    private boolean locked;


    public SimpleMessage(String inputString, int permLevel, String message, boolean locked) {
        super(GeneralUtils.toArray(inputString), permLevel, "A Basic Command");
        this.message = message;
        this.locked = locked;
    }
    @Override
    public void onCommand(User user, PircBotX Bot, Channel channel, boolean isPrivate,int UserPermLevel, String... args) throws Exception {
        String dresponse = this.message;
        String[] message = StringUtils.split(this.message, " ");
        int i = 0;
        for (String g : message) {
            if (g.startsWith("$") && !g.contains("*")) {
                dresponse = dresponse.replace(g, args[Integer.parseInt(g.replace("$", "")) - 1]);
                if (Integer.parseInt(g.replace("$", "")) > i) {
                    i++;
                }
            }
        }
        dresponse = dresponse.replace("$*", GeneralUtils.buildMessage(i, args.length, args));
        IRCUtils.SendMessage(user, channel, dresponse, isPrivate);
    }


    public String getMessage() {
        return this.message;
    }


    @Override
    public boolean getLockedStatus() {
        return locked;<commit_msg>Prevent infinite looping should MessageEvent ever get triggered by bots own events.<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.techcavern.wavetact.utils.objects;

import com.techcavern.wavetact.utils.GeneralRegistry;
import com.techcavern.wavetact.utils.GeneralUtils;
import com.techcavern.wavetact.utils.GetUtils;
import com.techcavern.wavetact.utils.IRCUtils;
import org.apache.commons.lang3.StringUtils;
import org.pircbotx.Channel;
import org.pircbotx.PircBotX;
import org.pircbotx.User;
import org.pircbotx.hooks.events.MessageEvent;

/**
 * @author jztech101
 */
public class SimpleMessage extends GenericCommand {

    private final String message;
    private boolean locked;


    public SimpleMessage(String inputString, int permLevel, String message, boolean locked) {
        super(GeneralUtils.toArray(inputString), permLevel, "A Basic Command");
        this.message = message;
        this.locked = locked;
    }
    @Override
    public void onCommand(User user, PircBotX Bot, Channel channel, boolean isPrivate,int UserPermLevel, String... args) throws Exception {
        String dresponse = this.message;
        String[] message = StringUtils.split(this.message, " ");
        int i = 0;
        for (String g : message) {
            if (g.startsWith("$") && !g.contains("*")) {
                dresponse = dresponse.replace(g, args[Integer.parseInt(g.replace("$", "")) - 1]);
                if (Integer.parseInt(g.replace("$", "")) > i) {
                    i++;
                }
            }
        }
        dresponse = dresponse.replace("$*", GeneralUtils.buildMessage(i, args.length, args));
        String prefix = GetUtils.getCommandChar(Bot);
        if(dresponse.startsWith(prefix)){
            dresponse.replace(prefix, "");
        }
        IRCUtils.SendMessage(user, channel, dresponse, isPrivate);
    }


    public String getMessage() {
        return this.message;
    }


    @Override
    public boolean getLockedStatus() {
        return locked;
{'fraction_non_alphanumeric': 0.11234567901234568, 'fraction_numerical': 0.002962962962962963, 'mean_word_length': 2.9637964774951078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '17724', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1153, 'n_words': 291}