<commit_before>package com.bwfcwalshy.flarebot.commands.administrator;

import com.bwfcwalshy.flarebot.FlareBot;
import com.bwfcwalshy.flarebot.MessageUtils;
import com.bwfcwalshy.flarebot.commands.Command;
import com.bwfcwalshy.flarebot.commands.CommandType;
import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.entities.TextChannel;
import net.dv8tion.jda.core.entities.User;

import java.util.List;

public class PinCommand implements Command {

    @Override
    public void onCommand(User sender, TextChannel channel, Message message, String[] args, Member member) {
        if(args.length == 1){
            if(FlareBot.getInstance().getPermissions(channel).hasPermission(member, "flarebot.pin")){
                String messageId = args[0].replaceAll("[^0-9]", "");
                Message msg = channel.getMessageById(messageId).complete();
                msg.pin().queue();
                channel.getHistory().retrievePast(1).complete().get(0).delete().queue();
            }
        }else{
            if(FlareBot.getInstance().getPermissions(channel).hasPermission(member, "flarebot.pin")){
                MessageUtils.sendErrorMessage("Usage: `pin (messageId)`", channel);
            }
        }
    }

    @Override
    public String getCommand() {
        return "pin";
    }<commit_msg>* Forgot it had an internal perm check *whistles*<commit_after>package com.bwfcwalshy.flarebot.commands.administrator;

import com.bwfcwalshy.flarebot.FlareBot;
import com.bwfcwalshy.flarebot.MessageUtils;
import com.bwfcwalshy.flarebot.commands.Command;
import com.bwfcwalshy.flarebot.commands.CommandType;
import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.Message;
import net.dv8tion.jda.core.entities.TextChannel;
import net.dv8tion.jda.core.entities.User;

public class PinCommand implements Command {

    @Override
    public void onCommand(User sender, TextChannel channel, Message message, String[] args, Member member) {
        if(args.length == 1){
            String messageId = args[0].replaceAll("[^0-9]", "");
            Message msg = channel.getMessageById(messageId).complete();
            msg.pin().queue();
            channel.getHistory().retrievePast(1).complete().get(0).delete().queue();
        }else{
            MessageUtils.sendErrorMessage("Usage: `pin (messageId)`", channel);
        }
    }

    @Override
    public String getCommand() {
        return "pin";
    }
{'fraction_non_alphanumeric': 0.1286970423661071, 'fraction_numerical': 0.007993605115907274, 'mean_word_length': 3.375874125874126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2656259', 'n_tokens_mistral': 774, 'n_tokens_neox': 753, 'n_words': 128}