const ESMCommand = require("../esm_command"); module.exports = class ESMCommand_Pay 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: "Pays the territory's protection money. Poptabs are taken from player's locker." }; 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: "pay", parameters: { function_name: "payTerritory", 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}, payment received for \`${this.info.parameters.territory_id}\` on \`${this.serverID}\`. It cost **${this.util.convertArmaNumber(this.params.payment)}** poptabs to pay protection, you now have **${this.util.convertArmaNumber(this.params.locker)}** poptabs left in your locker.`); } }