Config - Paultje52/SupaBotBase GitHub Wiki

With the function bot.setConfig, you can set your config. You can set a couple keys in this config to configure a couple things. The config is set on bot.config, in commands/events/functions on this.main.config.

Disable

There are three options you can disable.

  • Message: This disables the command triggers from normal text messages.
  • Slash: This disables slash command triggers.
  • MentionPrefix: This disables mention (@BOT) as a message trigger prefix.

When you want to disable something, set the key in the object disable as value true.

Example

disable: {
  message: false, // Don't disable message command triggers
  slash: true, // Disable slash command triggers
  mentionPrefix: true // Disable Mention Prefix
}

Prefix

When you don't use a database, you can set your own prefix with the prefix option. When you don't, the default prefix is ..

Example

prefix: "!" // Sets the prefix as ! (!help etc)

Database

With this option in the config, you can set default guild and user settings. There are two objects in this object.

  • defaultGuildSettings
  • defaultUserSettings

DefaultUserSettings This sets the default user settings.

Example

database: {
  defaultUserSettings: {
    balance: 100
  }
}

DefaultGuildSettings This sets the default guild settings. When you set prefix, it's the prefix in that guild.

Example

database: {
  DefaultGuildSettings: {
    prefix: "!"
  }
}

Messages

You can also edit the messages sent by the bot to the end user. Use the propery messages in the config. Set it to an object with the messages. These are all the messages you can change.

  messages: {
    errorWithDatabase: "**Error**\nAn error occurred while trying to run \`{0}\`.\nThis error has been reported with ID **#{1}**",
    errorWithoutDatabase: "An error occurred while trying to run this command. The error has been reported!",

    botNoPermissions: "Can't run this command. I'm missing the following permissions. {0}",
    userNoPermissions: "Can't run this command. You're missing the following permissions. {0}",

    wrongArguments: "Wrong arguments!",
    usage: "Usage",
    example: "Example",
    types: {
      4: "a valid number",
      5: "yes/no",
      6: "a user (Mention or ID)",
      7: "a channel (Mention or ID)",
      8: "a role (Mention or ID)"
    },
    needsToBe: "Needs to be {0}",

    chooseBetweenSubcommands: "You have to choose between the following subcommands.",
    orOtherOptions: "Or between the other options.",
    chooseBetweenOptions: "You have to choose between the following options."
  }

Whole config

This is an example of the whole config (Without the messages).

module.exports = {
  disable: {
    message: false,
    slash: false,
    mentionPrefix: false
  },
  prefix: ".",

  database: {
    defaultGuildSettings: {
      prefix: "!"
    },
    defaultUserSettings: {}
  }
};