UNPKG

@kingsworld/plugin-cron

Version:

A simple @sapphire/framework plugin that aims to make use of the croner package and allow users to make cron jobs within their Sapphire discord bot.

67 lines (64 loc) 2.53 kB
'use strict'; var pieces = require('@sapphire/pieces'); var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var _CronTask = class _CronTask extends pieces.Piece { constructor(context, options) { super(context, options); } /** * A helper function to log messages with the `CronTask[${name}]` prefix. * @param message The message to include after the prefix * @param other Extra parameters to pass to the logger * @example * this.info('Hello world!'); // CronTask[my-task] Hello world! */ info(message, ...other) { this.container.logger.info(`CronTask[${this.name}] ${message}`, ...other); } /** * A helper function to log messages with the `CronTask[${name}]` prefix. * @param message The message to include after the prefix * @param other Extra parameters to pass to the logger * @example * this.error('Something went wrong!'); // CronTask[my-task] Something went wrong! */ error(message, ...other) { this.container.logger.error(`CronTask[${this.name}] ${message}`, ...other); } /** * A helper function to log messages with the `CronTask[${name}]` prefix. * @param message The message to include after the prefix * @param other Extra parameters to pass to the logger * @example * this.warn('Something is not right!'); // CronTask[my-task] Something is not right! */ warn(message, ...other) { this.container.logger.warn(`CronTask[${this.name}] ${message}`, ...other); } /** * A helper function to log messages with the `CronTask[${name}]` prefix. * @param message The message to include after the prefix * @param other Extra parameters to pass to the logger * @example * this.debug('Something is happening!'); // CronTask[my-task] Something is happening! */ debug(message, ...other) { this.container.logger.debug(`CronTask[${this.name}] ${message}`, ...other); } /** * A helper function to log messages with the `CronTask[${name}]` prefix. * @param message The message to include after the prefix * @param other Extra parameters to pass to the logger * @example * this.trace('Loaded the file.'); // CronTask[my-task] Loaded the file. */ trace(message, ...other) { this.container.logger.trace(`CronTask[${this.name}] ${message}`, ...other); } }; __name(_CronTask, "CronTask"); var CronTask = _CronTask; exports.CronTask = CronTask; //# sourceMappingURL=CronTask.cjs.map //# sourceMappingURL=CronTask.cjs.map