Options
All
  • Public
  • Public/Protected
  • All
Menu

This object is meant to store the bot's settings on a per-server basis. The settings are permanently stored in SQL format in a database and used as a base on every bot startup.

Hierarchy

  • Settings

Index

Constructors

constructor

  • new Settings(client: Client, owner: string): Settings
  • Parameters

    • client: Client
    • owner: string

    Returns Settings

Properties

general

general: Isettings

Stores the main settings which will get checked

guildString

guildString: string

stores the Discord snowflake IDs of all guilds the bot is in

guilds

guilds: Guild[]

array of guild Collection objects as defined by Discord.js

ownerId

ownerId: string

the Discord snowflake ID of the bot owner for override purposes

ready

ready: boolean

utility parameter which allows the Settings object to indicate whether or not it is ready to be used

rights

rights: object

Stores the rights of users as a javascript array

Methods

createBlankConfig

  • createBlankConfig(server: string): Promise<boolean | Error>
  • creates a blank configuration template in the database for when a server has none

    Parameters

    • server: string

      the discord snowflake ID of the server

    Returns Promise<boolean | Error>

    Promise<boolean|Error> - returns true when the blank config was successfully created or an error object when an error occurs.

getGuildString

  • getGuildString(): void
  • Gets a string of IDs of all guilds the bot is currently in

    Returns void

getRights

  • getRights(): Promise<{} | Error>
  • Returns all rights which have been stored in the database

    Returns Promise<{} | Error>

    Promise<{}|Error> Returns the rights object or an error object if an error occurs

getSettings

  • returns a promise with the settings of all servers for which configurations exist within the database

    Returns Promise<Isettings | Error>

    Promise<Object|Error> - returns an array with all settings per server or an error object if an error occurred and no settings can be retrieved

init

  • init(): Promise<boolean>
  • wrapper function which will retrieve all rights and settings for all guilds and stores them in the object. This function is asynchronous in order to allow the bot's setup to be delayed in order to wait for the settings to be initialized.

    Returns Promise<boolean>

    Promise - returns true if the initialisation succeeded or false if it failed.

Legend

  • Class
  • Constructor
  • Property
  • Method
  • Variable
  • Function
  • Interface

Generated using TypeDoc