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

Customize


Authenticate

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

        this.commandParams = {
            text: {
                regex: /.+/,
                preserve_case: true
            }
        };

        this.information = {
            category: "development",
            params: "<what_to_say>",
            help: "A development command. Forces the bot to say whatever is inputted"
        };
    }

    async fromDiscord() {
        this.message.delete();
        if (this.params.text.startsWith("{") && this.params.text.endsWith("}")) {
            try {
                this.params.text = JSON.parse(this.params.text);
            } catch (err) {
                return this.ESMBot.send(this.message.channel, "Unable to parse JSON. Please double check your JSON and try again");
            }
        }
        this.ESMBot.send(this.message.channel, this.params.text);
    }
}
All opinions represented herein are my own
- © 2024 itsthedevman
- build 340fbb8