UNPKG

@averagehelper/corde

Version:

A simple library for Discord bot tests. (Republished fork to demonstrate a bugfix)

58 lines (57 loc) 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Config = void 0; /** * Default interface of json config * * @description `botTestToken` is not required. * only inform if is desired to start test bot with corde * */ class Config { /** * Set values to config options that are not **filed** yet * It means that all options that are already with a value will not lose * this value * * @example * const config = new Config(); * config.timeOut = 1000; * * const newConfig: ConfigOptions = { ...timeOut: 3000 }; * config.setNoFiledConfigsOptions(newConfig); * console.log(config.timeOut) // print 1000; * * @param config new set of configs. */ setNoFiledConfigsOptions(config) { if (!this.cordeTestToken) { this.cordeTestToken = config.cordeTestToken; } if (!this.botPrefix) { this.botPrefix = config.botPrefix; } if (!this.botTestId) { this.botTestId = config.botTestId; } if (!this.botTestToken) { this.botTestToken = config.botTestToken; } if (!this.channelId) { this.channelId = config.channelId; } if (!this.guildId) { this.guildId = config.guildId; } if (!this.timeOut) { this.timeOut = config.timeOut; } if (!this.botPrefix) { this.botPrefix = config.botPrefix; } if (!this.testFiles || this.testFiles.length === 0) { this.testFiles = config.testFiles; } } } exports.Config = Config;