Friday, September 20, 2024 1:24:14 AM
> settings

Customize


Authenticate

> upgrade.js
const ESMCommand = require("../esm_command");
module.exports = class ESMCommand_Upgrade extends ESMCommand {
    constructor(bot) {
        super(bot);
        this.permissions = {
            requires_registration: true,
            requires_server: true
        };

        this.commandParams = {
            serverID: {
                regex: this.util.regex.serverID.base
            },
            territoryID: {
                regex: this.util.regex.territoryID.base
            }
        };

        this.information = {
            category: "territory",
            params: "<server_id> <territory_id>",
            help: `Upgrades a territory to the next level. Poptabs are taken from player's locker. To see cost, run \`!territories\` command`
        };

        this.configuration = {
            allowedInTextChannels: {
                modifiable: true,
                default: false
            },
            cooldown: {
                modifiable: true,
                default: [2, "seconds"]
            },
            enabled: {
                modifiable: true,
                default: true
            }
        };
    }

    async fromDiscord() {
        this.send({
            serverID: this.params.serverID,
            command: "upgrade",
            parameters: {
                function_name: "upgradeTerritory",
                territory_id: this.params.territoryID,
                uid: this.params.steamUID
            }
        });
    }

    async fromServer() {
        if (this.util.isEmpty(this.params)) return;

        this.ESMBot.send(
            this.info.channel,
            `${this.info.author.tag}, you successfully upgraded your territory for **${this.util.convertArmaNumber(this.params.cost)}** poptabs.\nYour territory has reached level **${this.params.level}** and now has a new radius of **${this.params.range}** meters.\nYou have **${this.util.convertArmaNumber(this.params.locker)}** poptabs left in your locker`
        );
    }
}
All opinions represented herein are my own
- © 2024 itsthedevman
- build 340fbb8