UNPKG

@ayanaware/bentocord

Version:

Bentocord is a Bento plugin designed to rapidly build fully functional Discord Bots.

28 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IntegerOptionResolver = void 0; const eris_1 = require("eris"); const OptionType_1 = require("../constants/OptionType"); class IntegerOptionResolver { constructor() { this.option = OptionType_1.OptionType.INTEGER; this.convert = eris_1.Constants.ApplicationCommandOptionTypes.INTEGER; } async resolve(ctx, option, text) { const value = parseInt(text, 10); if (Number.isNaN(value)) return null; if (!Number.isSafeInteger(value)) return null; return value; } async help(ctx, option, data) { if ('min' in option) data.set(await ctx.formatTranslation('BENTOCORD_WORD_MIN', {}, 'Min'), option.min.toString()); if ('max' in option) data.set(await ctx.formatTranslation('BENTOCORD_WORD_MAX', {}, 'Max'), option.max.toString()); return data; } } exports.IntegerOptionResolver = IntegerOptionResolver; //# sourceMappingURL=IntegerOption.js.map