Friday, September 20, 2024 1:43:28 AM
> settings

Customize


Authenticate

> premium.js
const ESMCommand = require("../esm_command");
module.exports = class ESMCommand_Premium extends ESMCommand {
    constructor(bot) {
        super(bot);
        this.permissions = {
            admin_only: true
        };

        this.commandParams = {
            communityID: {
                regex: this.util.regex.communityID.base
            },
            option: {
                regex: /-1|0|1/
            }
        };

        this.information = {
            category: "administrative",
            params: "<community_id> <state (-1, 0, or 1)>",
            help: "An administrative command for developers only. This command changes the state of premium for a owner"
        };
    }

    async fromDiscord() {
        this.message.delete();
        if (!(await this.db.isValidCommunity(this.params.communityID))) {
            return this.ESMBot.send(this.message.channel, "I was unable to find the specified community");
        }

        let success = await this.db.setPremiumStatus(this.params.communityID, "0");
        if (!success) {
            return this.ESMBot.send(this.message.channel, "Unable to update premium status");
        }

        success = await this.db.setPremiumStatus(this.params.communityID, this.params.option);
        if (success) {
            this.ESMBot.send(this.message.channel, {
                "-1": `Welcome to the world of unlimited`,
                "0": `Premium removed`,
                "1": `One isn't the loneliest number when you have premium`
            } [this.params.option]);
        } else {
            this.ESMBot.send(this.message.channel, "Ohhhh boy, I done went off and messed up!");
        }
    }
}
All opinions represented herein are my own
- © 2024 itsthedevman
- build 340fbb8