<commit_before>package com.tisawesomeness.minecord.command.admin;

import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;

import com.tisawesomeness.minecord.Config;
import com.tisawesomeness.minecord.command.Command;

import net.dv8tion.jda.core.entities.PrivateChannel;
import net.dv8tion.jda.core.entities.User;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;

public class MsgCommand extends Command {
	
	public CommandInfo getInfo() {
		return new CommandInfo(
			"msg",
			"Open the DMs.",
			"<mention> <message>",
			new String[]{
				"dm",
				"tell",
				"pm"},
			0,
			true,
			true,
			false
		);
	}
	
	private final String regex = "[a-zA-Z]+ <@!?[0-9]+> ";
	
	public Result run(String[] args, MessageReceivedEvent e) {
		
		//Check for proper argument length
		if (args.length < 2) {
			return new Result(Outcome.WARNING, ":warning: Please specify a message.");
		}
		
		//Send the message
		User user = e.getMessage().getMentionedUsers().get(0);
		try {
			PrivateChannel channel = user.openPrivateChannel().submit().get();
			String msg = e.getMessage().getRawContent().replaceFirst(Pattern.quote(Config.getPrefix()) + regex, "");
			channel.sendMessage(msg).queue();
		} catch (InterruptedException | ExecutionException ex) {
			ex.printStackTrace();
		}
		
		return new Result(Outcome.SUCCESS, "");
	}
	
}<commit_msg>Added support for user IDs to define the user to DM<commit_after>package com.tisawesomeness.minecord.command.admin;

import java.util.concurrent.ExecutionException;
import org.apache.commons.lang3.ArrayUtils;

import com.tisawesomeness.minecord.Bot;
import com.tisawesomeness.minecord.command.Command;

import net.dv8tion.jda.core.entities.PrivateChannel;
import net.dv8tion.jda.core.entities.User;
import net.dv8tion.jda.core.events.message.MessageReceivedEvent;

public class MsgCommand extends Command {
	
	public CommandInfo getInfo() {
		return new CommandInfo(
			"msg",
			"Open the DMs.",
			"<mention> <message>",
			new String[]{
				"dm",
				"tell",
				"pm"},
			0,
			true,
			true,
			false
		);
	}
	
	private final String mentionRegex = "<@!?[0-9]+> ";
	private final String idRegex = "[0-9]{18}";
	
	public Result run(String[] args, MessageReceivedEvent e) {
		
		//Check for proper argument length
		if (args.length < 2) {
			return new Result(Outcome.WARNING, ":warning: Please specify a message.");
		}
		
		String param = e.getMessage().getRawContent().split(" ")[0];
		User user = null;
		if (param.matches(mentionRegex)) {
			user = e.getMessage().getMentionedUsers().get(0);
		} else if (param.matches(idRegex)) {
			user = Bot.jda.getUserById(param);
		} else {
			return new Result(Outcome.ERROR, ":x: Not a valid user!");
		}
		
		//Send the message
		try {
			PrivateChannel channel = user.openPrivateChannel().submit().get();
			String msg = String.join(" ", ArrayUtils.remove(args, 0));
			channel.sendMessage(msg).queue();
		} catch (InterruptedException | ExecutionException ex) {
			ex.printStackTrace();
		}
		
		return new Result(Outcome.SUCCESS, "");
	}
	
}
{'fraction_non_alphanumeric': 0.14234527687296417, 'fraction_numerical': 0.00749185667752443, 'mean_word_length': 3.9452495974235107, 'pattern_counts': {'":': 3, '<': 11, '<?xml version=': 0, '>': 9, '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': '1790738', 'n_tokens_mistral': 1137, 'n_tokens_neox': 990, 'n_words': 223}