<commit_before>const Plugin = require("./../Plugin");
const Util = require("../Util");

module.exports = class Kick extends Plugin {
    static get plugin() {
        return {
            name: "Kick",
            description: "Kicks users",
            help: "Reply with /kick or /ban, or send /[kick|ban] ID."
        };
    }

    constructor(obj) {
        super(obj);

        this.auth = obj.auth;
    }

    get commands() {
        return {
            banlist: ({message}) => {
                const chatID = message.chat.id;
                if (!this.db[chatID])
                    return "Empty.";
                return JSON.stringify(this.db[chatID]);
            },
            kick: ({message, args}) => {
                if (!this.auth.isMod(message.from.id, message.chat.id))
                    return "Insufficient privileges.";
                const target = Util.getTargetID(message, args, "kick");
                if (typeof target === "string") return target;
                if (this.auth.isMod(target, message.chat.id))
                    return "Can't kick mods or admins (demote the target first).";
                this.kick(message, target);
                return "Kicked.";
            },
            ban: ({message, args}) => {
                if (!this.auth.isMod(message.from.id, message.chat.id))
                    return "Insufficient privileges.";
                const target = Util.getTargetID(message, args, "ban");
                if (typeof target === "string") return target;
                if (this.auth.isMod(target, message.chat.id))
                    return "Can't ban mods or admins (demote the target first).";
                this.ban(message, target);
                this.kick(message, target);
                return "Banned.";
            },
            pardon: ({message, args}) => {
                if (!this.auth.isMod(message.from.id, message.chat.id))
                    return "Insufficient privileges.";
                const target = Util.getTargetID(message, args, "pardon");
                if (typeof target === "string") return target;
                if (!this.db[message.chat.id])
                    return "It seems that there are no banned users.";
                this.db[message.chat.id] = this.db[message.chat.id].filter(id => id !== target);
                return "Pardoned.";
            }
        };<commit_msg>/pardon -> /unban<commit_after>const Plugin = require("./../Plugin");
const Util = require("../Util");

module.exports = class Kick extends Plugin {
    static get plugin() {
        return {
            name: "Kick",
            description: "Kicks users",
            help: "Reply with /kick or /ban, or send /[kick|ban] ID."
        };
    }

    constructor(obj) {
        super(obj);

        this.auth = obj.auth;
    }

    get commands() {
        return {
            banlist: ({message}) => {
                const chatID = message.chat.id;
                if (!this.db[chatID])
                    return "Empty.";
                return JSON.stringify(this.db[chatID]);
            },
            kick: ({message, args}) => {
                if (!this.auth.isMod(message.from.id, message.chat.id))
                    return "Insufficient privileges.";
                const target = Util.getTargetID(message, args, "kick");
                if (typeof target === "string") return target;
                if (this.auth.isMod(target, message.chat.id))
                    return "Can't kick mods or admins (demote the target first).";
                this.kick(message, target);
                return "Kicked.";
            },
            ban: ({message, args}) => {
                if (!this.auth.isMod(message.from.id, message.chat.id))
                    return "Insufficient privileges.";
                const target = Util.getTargetID(message, args, "ban");
                if (typeof target === "string") return target;
                if (this.auth.isMod(target, message.chat.id))
                    return "Can't ban mods or admins (demote the target first).";
                this.ban(message, target);
                this.kick(message, target);
                return "Banned.";
            },
            unban: ({message, args}) => {
                if (!this.auth.isMod(message.from.id, message.chat.id))
                    return "Insufficient privileges.";
                const target = Util.getTargetID(message, args, "unban");
                if (typeof target === "string") return target;
                if (!this.db[message.chat.id])
                    return "It seems that there are no banned users.";
                this.db[message.chat.id] = this.db[message.chat.id].filter(id => id !== target);
                return "Unbanned.";
            }
        };
{'fraction_non_alphanumeric': 0.13511259382819016, 'fraction_numerical': 0.0, 'mean_word_length': 1.4803516028955532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '4850759', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1219, 'n_words': 323}