@sapphire/framework
Advanced tools
Comparing version 2.0.0-next.1e9359f1.0 to 2.0.0-next.1ea447f1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CoreArgument = void 0; | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
const truths = ['1', 'true', '+', 't', 'yes', 'y']; | ||
const falses = ['0', 'false', '-', 'f', 'no', 'n']; | ||
class CoreArgument extends Argument_1.Argument { | ||
@@ -12,8 +11,11 @@ constructor(context) { | ||
run(parameter, context) { | ||
const boolean = parameter.toLowerCase(); | ||
if (truths.includes(boolean)) | ||
return this.ok(true); | ||
if (falses.includes(boolean)) | ||
return this.ok(false); | ||
return this.error({ parameter, message: 'The argument did not resolve to a boolean.', context }); | ||
const resolved = resolvers_1.resolveBoolean(parameter, { truths: context.truths, falses: context.falses }); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: 'The argument did not resolve to a boolean.', | ||
context | ||
}); | ||
} | ||
@@ -20,0 +22,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CoreArgument = void 0; | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -10,10 +11,11 @@ class CoreArgument extends Argument_1.Argument { | ||
run(parameter, context) { | ||
const channel = (context.message.guild ? context.message.guild.channels : this.container.client.channels).cache.get(parameter); | ||
return channel | ||
? this.ok(channel) | ||
: this.error({ | ||
parameter, | ||
message: 'The argument did not resolve to a channel.', | ||
context: { ...context, channel } | ||
}); | ||
const resolved = resolvers_1.resolveChannel(parameter, context.message); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: 'The argument did not resolve to a channel.', | ||
context | ||
}); | ||
} | ||
@@ -20,0 +22,0 @@ } |
@@ -5,2 +5,3 @@ "use strict"; | ||
require("../lib/errors/Identifiers"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -10,20 +11,18 @@ class CoreArgument extends Argument_1.Argument { | ||
super(context, { name: 'date' }); | ||
this.messages = { | ||
["dateTooEarly" /* ArgumentDateTooEarly */]: ({ minimum }) => `The given date must be after ${new Date(minimum).toISOString()}.`, | ||
["dateTooFar" /* ArgumentDateTooFar */]: ({ maximum }) => `The given date must be before ${new Date(maximum).toISOString()}.`, | ||
["dateError" /* ArgumentDateError */]: () => 'The argument did not resolve to a date.' | ||
}; | ||
} | ||
run(parameter, context) { | ||
const parsed = new Date(parameter); | ||
const time = parsed.getTime(); | ||
if (Number.isNaN(time)) { | ||
return this.error({ | ||
parameter, | ||
message: 'The argument did not resolve to a valid date.', | ||
context | ||
}); | ||
} | ||
if (typeof context.minimum === 'number' && time < context.minimum) { | ||
return this.error({ parameter, identifier: "dateTooSmall" /* ArgumentDateTooSmall */, message: 'The argument is too small.', context }); | ||
} | ||
if (typeof context.maximum === 'number' && time > context.maximum) { | ||
return this.error({ parameter, identifier: "dateTooBig" /* ArgumentDateTooBig */, message: 'The argument is too big.', context }); | ||
} | ||
return this.ok(parsed); | ||
const resolved = resolvers_1.resolveDate(parameter, { minimum: context.minimum, maximum: context.maximum }); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: this.messages[resolved.error](context), | ||
context | ||
}); | ||
} | ||
@@ -30,0 +29,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CoreArgument = void 0; | ||
const discord_js_utilities_1 = require("@sapphire/discord.js-utilities"); | ||
const ExtendedArgument_1 = require("../lib/structures/ExtendedArgument"); | ||
class CoreArgument extends ExtendedArgument_1.ExtendedArgument { | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
class CoreArgument extends Argument_1.Argument { | ||
constructor(context) { | ||
super(context, { baseArgument: 'channel', name: 'dmChannel' }); | ||
super(context, { name: 'dmChannel' }); | ||
} | ||
handle(channel, context) { | ||
return discord_js_utilities_1.isDMChannel(channel) | ||
? this.ok(channel) | ||
: this.error({ | ||
parameter: context.parameter, | ||
message: 'The argument did not resolve to a DM channel.', | ||
context: { ...context, channel } | ||
}); | ||
run(parameter, context) { | ||
const resolved = resolvers_1.resolveDMChannel(parameter, context.message); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: 'The argument did not resolve to a DM channel.', | ||
context | ||
}); | ||
} | ||
@@ -19,0 +21,0 @@ } |
@@ -5,2 +5,3 @@ "use strict"; | ||
require("../lib/errors/Identifiers"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -10,25 +11,18 @@ class CoreArgument extends Argument_1.Argument { | ||
super(context, { name: 'float' }); | ||
this.messages = { | ||
["floatTooSmall" /* ArgumentFloatTooSmall */]: ({ minimum }) => `The given number must be greater than ${minimum}.`, | ||
["floatTooLarge" /* ArgumentFloatTooLarge */]: ({ maximum }) => `The given number must be less than ${maximum}.`, | ||
["floatError" /* ArgumentFloatError */]: () => 'The argument did not resolve to a valid decimal.' | ||
}; | ||
} | ||
run(parameter, context) { | ||
const parsed = Number(parameter); | ||
if (Number.isNaN(parsed)) { | ||
return this.error({ parameter, message: 'The argument did not resolve to a valid floating point number.', context }); | ||
} | ||
if (typeof context.minimum === 'number' && parsed < context.minimum) { | ||
return this.error({ | ||
parameter, | ||
identifier: "floatTooSmall" /* ArgumentFloatTooSmall */, | ||
message: `The argument must be greater than ${context.minimum}.`, | ||
context | ||
}); | ||
} | ||
if (typeof context.maximum === 'number' && parsed > context.maximum) { | ||
return this.error({ | ||
parameter, | ||
identifier: "floatTooBig" /* ArgumentFloatTooBig */, | ||
message: `The argument must be less than ${context.maximum}.`, | ||
context | ||
}); | ||
} | ||
return this.ok(parsed); | ||
const resolved = resolvers_1.resolveFloat(parameter, { minimum: context.minimum, maximum: context.maximum }); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: this.messages[resolved.error](context), | ||
context | ||
}); | ||
} | ||
@@ -35,0 +29,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CoreArgument = void 0; | ||
const discord_utilities_1 = require("@sapphire/discord-utilities"); | ||
require("../lib/errors/Identifiers"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -12,3 +12,2 @@ class CoreArgument extends Argument_1.Argument { | ||
run(parameter, context) { | ||
var _a; | ||
const { guild } = context.message; | ||
@@ -18,28 +17,19 @@ if (!guild) { | ||
parameter, | ||
identifier: "guildChannelMissingGuild" /* ArgumentGuildChannelMissingGuild */, | ||
message: 'The argument must be run in a guild.', | ||
context: { ...context, guild } | ||
identifier: "guildChannelMissingGuildError" /* ArgumentGuildChannelMissingGuildError */, | ||
message: 'This command can only be used in a server.', | ||
context | ||
}); | ||
} | ||
const channel = (_a = this.resolveByID(parameter, guild)) !== null && _a !== void 0 ? _a : this.resolveByQuery(parameter, guild); | ||
return channel | ||
? this.ok(channel) | ||
: this.error({ | ||
parameter, | ||
message: 'The argument did not resolve to a guild channel.', | ||
context: { ...context, guild } | ||
}); | ||
const resolved = resolvers_1.resolveGuildChannel(parameter, guild); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: 'The argument did not resolve to a valid server channel.', | ||
context: { ...context, guild } | ||
}); | ||
} | ||
resolveByID(argument, guild) { | ||
var _a, _b; | ||
const channelID = (_a = discord_utilities_1.ChannelMentionRegex.exec(argument)) !== null && _a !== void 0 ? _a : discord_utilities_1.SnowflakeRegex.exec(argument); | ||
return channelID ? (_b = guild.channels.cache.get(channelID[1])) !== null && _b !== void 0 ? _b : null : null; | ||
} | ||
resolveByQuery(argument, guild) { | ||
var _a; | ||
const lowerCaseArgument = argument.toLowerCase(); | ||
return (_a = guild.channels.cache.find((channel) => channel.name.toLowerCase() === lowerCaseArgument)) !== null && _a !== void 0 ? _a : null; | ||
} | ||
} | ||
exports.CoreArgument = CoreArgument; | ||
//# sourceMappingURL=CoreGuildChannel.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CoreArgument = void 0; | ||
const url_1 = require("url"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -11,8 +11,11 @@ class CoreArgument extends Argument_1.Argument { | ||
run(parameter, context) { | ||
try { | ||
return this.ok(new url_1.URL(parameter)); | ||
} | ||
catch { | ||
return this.error({ parameter, message: 'The argument did not resolve to a valid URL.', context }); | ||
} | ||
const resolved = resolvers_1.resolveHyperlink(parameter); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: 'The argument did not resolve to a valid URL.', | ||
context | ||
}); | ||
} | ||
@@ -19,0 +22,0 @@ } |
@@ -5,2 +5,3 @@ "use strict"; | ||
require("../lib/errors/Identifiers"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -10,29 +11,18 @@ class CoreArgument extends Argument_1.Argument { | ||
super(context, { name: 'integer' }); | ||
this.messages = { | ||
["integerTooSmall" /* ArgumentIntegerTooSmall */]: ({ minimum }) => `The given number must be greater than ${minimum}.`, | ||
["integerTooLarge" /* ArgumentIntegerTooLarge */]: ({ maximum }) => `The given number must be less than ${maximum}.`, | ||
["integerError" /* ArgumentIntegerError */]: () => 'The argument did not resolve to a valid number.' | ||
}; | ||
} | ||
run(parameter, context) { | ||
const parsed = Number(parameter); | ||
if (!Number.isInteger(parsed)) { | ||
return this.error({ | ||
parameter, | ||
message: 'The argument did not resolve to an integer.', | ||
context | ||
}); | ||
} | ||
if (typeof context.minimum === 'number' && parsed < context.minimum) { | ||
return this.error({ | ||
parameter, | ||
identifier: "integerTooSmall" /* ArgumentIntegerTooSmall */, | ||
message: `The argument must be greater than ${context.minimum}.`, | ||
context | ||
}); | ||
} | ||
if (typeof context.maximum === 'number' && parsed > context.maximum) { | ||
return this.error({ | ||
parameter, | ||
identifier: "integerTooBig" /* ArgumentIntegerTooBig */, | ||
message: `The argument must be less than ${context.maximum}.`, | ||
context | ||
}); | ||
} | ||
return this.ok(parsed); | ||
const resolved = resolvers_1.resolveInteger(parameter, { minimum: context.minimum, maximum: context.maximum }); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: this.messages[resolved.error](context), | ||
context | ||
}); | ||
} | ||
@@ -39,0 +29,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CoreArgument = void 0; | ||
const discord_utilities_1 = require("@sapphire/discord-utilities"); | ||
require("../lib/errors/Identifiers"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -12,3 +12,2 @@ class CoreArgument extends Argument_1.Argument { | ||
async run(parameter, context) { | ||
var _a; | ||
const { guild } = context.message; | ||
@@ -19,32 +18,18 @@ if (!guild) { | ||
identifier: "memberMissingGuild" /* ArgumentMemberMissingGuild */, | ||
message: 'The argument must be run on a guild.', | ||
context: { ...context, guild } | ||
message: 'This command can only be used in a server.', | ||
context | ||
}); | ||
} | ||
const member = (_a = (await this.resolveByID(parameter, guild))) !== null && _a !== void 0 ? _a : (await this.resolveByQuery(parameter, guild)); | ||
return member | ||
? this.ok(member) | ||
: this.error({ | ||
parameter, | ||
message: 'The argument did not resolve to a member.', | ||
context: { ...context, guild } | ||
}); | ||
const resolved = await resolvers_1.resolveMember(parameter, guild); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: 'The given argument did not resolve to a server member.', | ||
context: { ...context, guild } | ||
}); | ||
} | ||
async resolveByID(argument, guild) { | ||
var _a; | ||
const memberID = (_a = discord_utilities_1.UserOrMemberMentionRegex.exec(argument)) !== null && _a !== void 0 ? _a : discord_utilities_1.SnowflakeRegex.exec(argument); | ||
return memberID ? guild.members.fetch(memberID[1]).catch(() => null) : null; | ||
} | ||
async resolveByQuery(argument, guild) { | ||
var _a; | ||
const members = await guild.members | ||
.fetch({ | ||
query: argument, | ||
limit: 1 | ||
}) | ||
.catch(() => null); | ||
return (_a = members === null || members === void 0 ? void 0 : members.first()) !== null && _a !== void 0 ? _a : null; | ||
} | ||
} | ||
exports.CoreArgument = CoreArgument; | ||
//# sourceMappingURL=CoreMember.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CoreArgument = void 0; | ||
const discord_js_utilities_1 = require("@sapphire/discord.js-utilities"); | ||
const discord_js_1 = require("discord.js"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -12,40 +11,15 @@ class CoreArgument extends Argument_1.Argument { | ||
async run(parameter, context) { | ||
var _a, _b; | ||
const channel = (_a = context.channel) !== null && _a !== void 0 ? _a : context.message.channel; | ||
const message = (_b = (await this.resolveByID(parameter, channel))) !== null && _b !== void 0 ? _b : (await this.resolveByLink(parameter, context)); | ||
return message | ||
? this.ok(message) | ||
: this.error({ | ||
parameter, | ||
message: 'The argument did not resolve to a message.', | ||
context: { ...context, channel } | ||
}); | ||
const channel = context.channel ?? context.message.channel; | ||
const resolved = await resolvers_1.resolveMessage(parameter, { message: context.message, channel: context.channel }); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: 'The given argument did not resolve to a message.', | ||
context: { ...context, channel } | ||
}); | ||
} | ||
async resolveByID(argument, channel) { | ||
return discord_js_utilities_1.SnowflakeRegex.test(argument) ? channel.messages.fetch(argument).catch(() => null) : null; | ||
} | ||
async resolveByLink(argument, { message }) { | ||
var _a; | ||
if (!message.guild) | ||
return null; | ||
const matches = discord_js_utilities_1.MessageLinkRegex.exec(argument); | ||
if (!matches) | ||
return null; | ||
const [, guildID, channelID, messageID] = matches; | ||
const guild = this.container.client.guilds.cache.get(guildID); | ||
if (guild !== message.guild) | ||
return null; | ||
const channel = guild.channels.cache.get(channelID); | ||
if (!channel) | ||
return null; | ||
if (!(discord_js_utilities_1.isNewsChannel(channel) || discord_js_utilities_1.isTextChannel(channel))) | ||
return null; | ||
if (!channel.viewable) | ||
return null; | ||
if (!((_a = channel.permissionsFor(message.author)) === null || _a === void 0 ? void 0 : _a.has(discord_js_1.Permissions.FLAGS.VIEW_CHANNEL))) | ||
return null; | ||
return channel.messages.fetch(messageID).catch(() => null); | ||
} | ||
} | ||
exports.CoreArgument = CoreArgument; | ||
//# sourceMappingURL=CoreMessage.js.map |
@@ -5,2 +5,3 @@ "use strict"; | ||
require("../lib/errors/Identifiers"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -10,29 +11,18 @@ class CoreArgument extends Argument_1.Argument { | ||
super(context, { name: 'number' }); | ||
this.messages = { | ||
["numberTooSmall" /* ArgumentNumberTooSmall */]: ({ minimum }) => `The given number must be greater than ${minimum}.`, | ||
["numberTooLarge" /* ArgumentNumberTooLarge */]: ({ maximum }) => `The given number must be less than ${maximum}.`, | ||
["numberError" /* ArgumentNumberError */]: () => 'The argument did not resolve to a valid number.' | ||
}; | ||
} | ||
run(parameter, context) { | ||
const parsed = Number(parameter); | ||
if (Number.isNaN(parsed)) { | ||
return this.error({ | ||
parameter, | ||
message: 'The argument did not resolve to a valid number.', | ||
context | ||
}); | ||
} | ||
if (typeof context.minimum === 'number' && parsed < context.minimum) { | ||
return this.error({ | ||
parameter, | ||
identifier: "numberTooSmall" /* ArgumentNumberTooSmall */, | ||
message: `The argument must be greater than ${context.minimum}.`, | ||
context | ||
}); | ||
} | ||
if (typeof context.maximum === 'number' && parsed > context.maximum) { | ||
return this.error({ | ||
parameter, | ||
identifier: "numberTooBig" /* ArgumentNumberTooBig */, | ||
message: `The argument must be smaller than ${context.maximum}.`, | ||
context | ||
}); | ||
} | ||
return this.ok(parsed); | ||
const resolved = resolvers_1.resolveNumber(parameter, { minimum: context.minimum, maximum: context.maximum }); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: this.messages[resolved.error](context), | ||
context | ||
}); | ||
} | ||
@@ -39,0 +29,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CoreArgument = void 0; | ||
const discord_utilities_1 = require("@sapphire/discord-utilities"); | ||
require("../lib/errors/Identifiers"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -12,3 +12,2 @@ class CoreArgument extends Argument_1.Argument { | ||
async run(parameter, context) { | ||
var _a; | ||
const { guild } = context.message; | ||
@@ -19,21 +18,18 @@ if (!guild) { | ||
identifier: "roleMissingGuild" /* ArgumentRoleMissingGuild */, | ||
message: 'The argument must be run on a guild.', | ||
message: 'This command can only be used in a server.', | ||
context | ||
}); | ||
} | ||
const role = (_a = (await this.resolveByID(parameter, guild))) !== null && _a !== void 0 ? _a : this.resolveByQuery(parameter, guild); | ||
return role ? this.ok(role) : this.error({ parameter, message: 'The argument did not resolve to a role.', context }); | ||
const resolved = await resolvers_1.resolveRole(parameter, guild); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: 'The given argument did not resolve to a role.', | ||
context: { ...context, guild } | ||
}); | ||
} | ||
async resolveByID(argument, guild) { | ||
var _a; | ||
const roleID = (_a = discord_utilities_1.RoleMentionRegex.exec(argument)) !== null && _a !== void 0 ? _a : discord_utilities_1.SnowflakeRegex.exec(argument); | ||
return roleID ? guild.roles.fetch(roleID[1]).catch(() => null) : null; | ||
} | ||
resolveByQuery(argument, guild) { | ||
var _a; | ||
const lowerCaseArgument = argument.toLowerCase(); | ||
return (_a = guild.roles.cache.find((role) => role.name.toLowerCase() === lowerCaseArgument)) !== null && _a !== void 0 ? _a : null; | ||
} | ||
} | ||
exports.CoreArgument = CoreArgument; | ||
//# sourceMappingURL=CoreRole.js.map |
@@ -5,2 +5,3 @@ "use strict"; | ||
require("../lib/errors/Identifiers"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -10,21 +11,17 @@ class CoreArgument extends Argument_1.Argument { | ||
super(context, { name: 'string' }); | ||
this.messages = { | ||
["stringTooShort" /* ArgumentStringTooShort */]: ({ minimum }) => `The argument must be longer than ${minimum} characters.`, | ||
["stringTooLong" /* ArgumentStringTooLong */]: ({ maximum }) => `The argument must be shorter than ${maximum} characters.` | ||
}; | ||
} | ||
run(parameter, context) { | ||
if (typeof context.minimum === 'number' && parameter.length < context.minimum) { | ||
return this.error({ | ||
parameter, | ||
identifier: "stringTooShort" /* ArgumentStringTooShort */, | ||
message: `The argument must be longer than ${context.minimum} characters.`, | ||
context | ||
}); | ||
} | ||
if (typeof context.maximum === 'number' && parameter.length > context.maximum) { | ||
return this.error({ | ||
parameter, | ||
identifier: "stringTooLong" /* ArgumentStringTooLong */, | ||
message: `The argument must be shorter than ${context.maximum} characters.`, | ||
context | ||
}); | ||
} | ||
return this.ok(parameter); | ||
const resolved = resolvers_1.resolveString(parameter, { minimum: context?.minimum, maximum: context?.maximum }); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: this.messages[resolved.error](context), | ||
context | ||
}); | ||
} | ||
@@ -31,0 +28,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CoreArgument = void 0; | ||
const discord_utilities_1 = require("@sapphire/discord-utilities"); | ||
const resolvers_1 = require("../lib/resolvers"); | ||
const Argument_1 = require("../lib/structures/Argument"); | ||
@@ -11,6 +11,11 @@ class CoreArgument extends Argument_1.Argument { | ||
async run(parameter, context) { | ||
var _a; | ||
const userID = (_a = discord_utilities_1.UserOrMemberMentionRegex.exec(parameter)) !== null && _a !== void 0 ? _a : discord_utilities_1.SnowflakeRegex.exec(parameter); | ||
const user = userID ? await this.container.client.users.fetch(userID[1]).catch(() => null) : null; | ||
return user ? this.ok(user) : this.error({ parameter, message: 'The argument did not resolve to a user.', context }); | ||
const resolved = await resolvers_1.resolveUser(parameter); | ||
if (resolved.success) | ||
return this.ok(resolved.value); | ||
return this.error({ | ||
parameter, | ||
identifier: resolved.error, | ||
message: 'The given argument did not resolve to a Discord user.', | ||
context | ||
}); | ||
} | ||
@@ -17,0 +22,0 @@ } |
@@ -1,6 +0,6 @@ | ||
/* Version: 2.0.0-next.1e9359f1.0 - June 19, 2021 10:50:08 */ | ||
/* Version: 2.0.0-next.1ea447f1.0 - August 25, 2021 01:11:55 */ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = exports.Store = exports.Piece = exports.MissingExportsError = exports.LoaderError = exports.container = exports.AliasStore = exports.AliasPiece = void 0; | ||
exports.version = exports.ClientPermissionsCorePrecondition = exports.Resolvers = exports.StoreRegistry = exports.Store = exports.Piece = exports.MissingExportsError = exports.LoaderError = exports.container = exports.AliasStore = exports.AliasPiece = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -15,2 +15,3 @@ var pieces_1 = require("@sapphire/pieces"); | ||
Object.defineProperty(exports, "Store", { enumerable: true, get: function () { return pieces_1.Store; } }); | ||
Object.defineProperty(exports, "StoreRegistry", { enumerable: true, get: function () { return pieces_1.StoreRegistry; } }); | ||
tslib_1.__exportStar(require("./lib/errors/ArgumentError"), exports); | ||
@@ -26,2 +27,3 @@ tslib_1.__exportStar(require("./lib/errors/Identifiers"), exports); | ||
tslib_1.__exportStar(require("./lib/plugins/symbols"), exports); | ||
exports.Resolvers = tslib_1.__importStar(require("./lib/resolvers")); | ||
tslib_1.__exportStar(require("./lib/SapphireClient"), exports); | ||
@@ -32,8 +34,7 @@ tslib_1.__exportStar(require("./lib/structures/Argument"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/CommandStore"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/Event"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/EventStore"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/ExtendedArgument"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/Listener"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/ListenerStore"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/Precondition"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/PreconditionStore"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/StoreRegistry"), exports); | ||
tslib_1.__exportStar(require("./lib/types/Enums"), exports); | ||
@@ -46,6 +47,9 @@ tslib_1.__exportStar(require("./lib/types/Events"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/preconditions/conditions/PreconditionConditionOr"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/preconditions/containers/PermissionsPrecondition"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/preconditions/containers/ClientPermissionsPrecondition"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/preconditions/containers/UserPermissionsPrecondition"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/preconditions/IPreconditionContainer"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/preconditions/PreconditionContainerArray"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/preconditions/PreconditionContainerSingle"), exports); | ||
exports.version = '2.0.0-next.1e9359f1.0'; | ||
var ClientPermissions_1 = require("./preconditions/ClientPermissions"); | ||
Object.defineProperty(exports, "ClientPermissionsCorePrecondition", { enumerable: true, get: function () { return ClientPermissions_1.CorePrecondition; } }); | ||
exports.version = '2.0.0-next.1ea447f1.0'; |
@@ -12,4 +12,3 @@ "use strict"; | ||
constructor(options) { | ||
var _a; | ||
super({ ...options, identifier: (_a = options.identifier) !== null && _a !== void 0 ? _a : options.argument.name }); | ||
super({ ...options, identifier: options.identifier ?? options.argument.name }); | ||
this.argument = options.argument; | ||
@@ -16,0 +15,0 @@ this.parameter = options.parameter; |
@@ -6,43 +6,53 @@ "use strict"; | ||
(function (Identifiers) { | ||
Identifiers["ArgumentBoolean"] = "boolean"; | ||
Identifiers["ArgumentCategoryChannel"] = "categoryChannel"; | ||
Identifiers["ArgumentChannel"] = "channel"; | ||
Identifiers["ArgumentDate"] = "date"; | ||
Identifiers["ArgumentDateTooSmall"] = "dateTooSmall"; | ||
Identifiers["ArgumentDateTooBig"] = "dateTooBig"; | ||
Identifiers["ArgumentDMChannel"] = "dmChannel"; | ||
Identifiers["ArgumentFloat"] = "float"; | ||
Identifiers["ArgsMissing"] = "argsMissing"; | ||
Identifiers["ArgsUnavailable"] = "argsUnavailable"; | ||
Identifiers["ArgumentBooleanError"] = "booleanError"; | ||
Identifiers["ArgumentChannelError"] = "channelError"; | ||
Identifiers["ArgumentDateError"] = "dateError"; | ||
Identifiers["ArgumentDateTooEarly"] = "dateTooEarly"; | ||
Identifiers["ArgumentDateTooFar"] = "dateTooFar"; | ||
Identifiers["ArgumentDMChannelError"] = "dmChannelError"; | ||
Identifiers["ArgumentFloatError"] = "floatError"; | ||
Identifiers["ArgumentFloatTooLarge"] = "floatTooLarge"; | ||
Identifiers["ArgumentFloatTooSmall"] = "floatTooSmall"; | ||
Identifiers["ArgumentFloatTooBig"] = "floatTooBig"; | ||
Identifiers["ArgumentGuildChannel"] = "guildChannel"; | ||
Identifiers["ArgumentGuildChannelMissingGuild"] = "guildChannelMissingGuild"; | ||
Identifiers["ArgumentHyperlink"] = "hyperlink"; | ||
Identifiers["ArgumentInteger"] = "integer"; | ||
Identifiers["ArgumentGuildCategoryChannelError"] = "categoryChannelError"; | ||
Identifiers["ArgumentGuildChannelError"] = "guildChannelError"; | ||
Identifiers["ArgumentGuildChannelMissingGuildError"] = "guildChannelMissingGuildError"; | ||
Identifiers["ArgumentGuildNewsChannelError"] = "guildNewsChannelError"; | ||
Identifiers["ArgumentGuildNewsThreadChannelError"] = "guildNewsChannelError"; | ||
Identifiers["ArgumentGuildPrivateThreadChannelError"] = "guildPrivateThreadChannelError"; | ||
Identifiers["ArgumentGuildPublicThreadChannelError"] = "guildPublicThreadChannelError"; | ||
Identifiers["ArgumentGuildStageVoiceChannelError"] = "guildStageVoiceChannelError"; | ||
Identifiers["ArgumentGuildTextChannelError"] = "guildTextChannelError"; | ||
Identifiers["ArgumentGuildThreadChannelError"] = "guildThreadChannelError"; | ||
Identifiers["ArgumentGuildVoiceChannelError"] = "guildVoiceChannelError"; | ||
Identifiers["ArgumentHyperlinkError"] = "hyperlinkError"; | ||
Identifiers["ArgumentIntegerError"] = "integerError"; | ||
Identifiers["ArgumentIntegerTooLarge"] = "integerTooLarge"; | ||
Identifiers["ArgumentIntegerTooSmall"] = "integerTooSmall"; | ||
Identifiers["ArgumentIntegerTooBig"] = "integerTooBig"; | ||
Identifiers["ArgumentMember"] = "member"; | ||
Identifiers["ArgumentMemberError"] = "memberError"; | ||
Identifiers["ArgumentMemberMissingGuild"] = "memberMissingGuild"; | ||
Identifiers["ArgumentMessage"] = "message"; | ||
Identifiers["ArgumentNewsChannel"] = "newsChannel"; | ||
Identifiers["ArgumentNumber"] = "number"; | ||
Identifiers["ArgumentMessageError"] = "messageError"; | ||
Identifiers["ArgumentNumberError"] = "numberError"; | ||
Identifiers["ArgumentNumberTooLarge"] = "numberTooLarge"; | ||
Identifiers["ArgumentNumberTooSmall"] = "numberTooSmall"; | ||
Identifiers["ArgumentNumberTooBig"] = "numberTooBig"; | ||
Identifiers["ArgumentRole"] = "role"; | ||
Identifiers["ArgumentRoleError"] = "roleError"; | ||
Identifiers["ArgumentRoleMissingGuild"] = "roleMissingGuild"; | ||
Identifiers["ArgumentStringTooLong"] = "stringTooLong"; | ||
Identifiers["ArgumentStringTooShort"] = "stringTooShort"; | ||
Identifiers["ArgumentStringTooLong"] = "stringTooLong"; | ||
Identifiers["ArgumentTextChannel"] = "textChannel"; | ||
Identifiers["ArgumentUser"] = "user"; | ||
Identifiers["ArgumentVoiceChannel"] = "voiceChannel"; | ||
Identifiers["ArgsUnavailable"] = "argsUnavailable"; | ||
Identifiers["ArgsMissing"] = "argsMissing"; | ||
Identifiers["ArgumentUserError"] = "userError"; | ||
Identifiers["CommandDisabled"] = "commandDisabled"; | ||
Identifiers["PreconditionCooldown"] = "preconditionCooldown"; | ||
Identifiers["PreconditionDMOnly"] = "preconditionDmOnly"; | ||
Identifiers["PreconditionGuildNewsOnly"] = "preconditionGuildNewsOnly"; | ||
Identifiers["PreconditionGuildNewsThreadOnly"] = "preconditionGuildNewsThreadOnly"; | ||
Identifiers["PreconditionGuildOnly"] = "preconditionGuildOnly"; | ||
Identifiers["PreconditionNewsOnly"] = "preconditionNewsOnly"; | ||
Identifiers["PreconditionGuildPrivateThreadOnly"] = "preconditionGuildPrivateThreadOnly"; | ||
Identifiers["PreconditionGuildPublicThreadOnly"] = "preconditionGuildPublicThreadOnly"; | ||
Identifiers["PreconditionGuildTextOnly"] = "preconditionGuildTextOnly"; | ||
Identifiers["PreconditionNSFW"] = "preconditionNsfw"; | ||
Identifiers["PreconditionPermissions"] = "preconditionPermissions"; | ||
Identifiers["PreconditionTextOnly"] = "preconditionTextOnly"; | ||
Identifiers["PreconditionClientPermissions"] = "preconditionClientPermissions"; | ||
Identifiers["PreconditionUserPermissions"] = "preconditionUserPermissions"; | ||
Identifiers["PreconditionThreadOnly"] = "preconditionThreadOnly"; | ||
})(Identifiers = exports.Identifiers || (exports.Identifiers = {})); | ||
//# sourceMappingURL=Identifiers.js.map |
@@ -11,4 +11,3 @@ "use strict"; | ||
constructor(options) { | ||
var _a; | ||
super({ ...options, identifier: (_a = options.identifier) !== null && _a !== void 0 ? _a : options.precondition.name }); | ||
super({ ...options, identifier: options.identifier ?? options.precondition.name }); | ||
this.precondition = options.precondition; | ||
@@ -15,0 +14,0 @@ } |
@@ -15,6 +15,5 @@ "use strict"; | ||
constructor(options) { | ||
var _a; | ||
super(options.message); | ||
this.identifier = options.identifier; | ||
this.context = (_a = options.context) !== null && _a !== void 0 ? _a : null; | ||
this.context = options.context ?? null; | ||
} | ||
@@ -21,0 +20,0 @@ // eslint-disable-next-line @typescript-eslint/class-literal-property-style |
@@ -89,3 +89,2 @@ "use strict"; | ||
async repeatResult(type, options = {}) { | ||
var _a; | ||
const argument = this.resolveArgument(type); | ||
@@ -97,3 +96,3 @@ if (!argument) | ||
const output = []; | ||
for (let i = 0, times = (_a = options.times) !== null && _a !== void 0 ? _a : Infinity; i < times; i++) { | ||
for (let i = 0, times = options.times ?? Infinity; i < times; i++) { | ||
const result = await this.parser.singleParseAsync(async (arg) => argument.run(arg, { | ||
@@ -100,0 +99,0 @@ args: this, |
@@ -10,5 +10,4 @@ "use strict"; | ||
const CommandStore_1 = require("./structures/CommandStore"); | ||
const EventStore_1 = require("./structures/EventStore"); | ||
const ListenerStore_1 = require("./structures/ListenerStore"); | ||
const PreconditionStore_1 = require("./structures/PreconditionStore"); | ||
const StoreRegistry_1 = require("./structures/StoreRegistry"); | ||
require("./types/Enums"); | ||
@@ -22,5 +21,4 @@ const Events_1 = require("./types/Events"); | ||
* | ||
* Sapphire also automatically detects the folders to scan for pieces, please read | ||
* {@link SapphireClient.registerUserDirectories} for reference. This method is called at the start of the | ||
* {@link SapphireClient.login} method. | ||
* Sapphire also automatically detects the folders to scan for pieces, please read {@link StoreRegistry.registerPath} | ||
* for reference. This method is called at the start of the {@link SapphireClient.login} method. | ||
* | ||
@@ -66,4 +64,3 @@ * @see {@link SapphireClientOptions} for all options available to the Sapphire Client. You can also provide all of discord.js' [ClientOptions](https://discord.js.org/#/docs/main/stable/typedef/ClientOptions) | ||
class SapphireClient extends discord_js_1.Client { | ||
constructor(options = {}) { | ||
var _a, _b, _c, _d, _e, _f; | ||
constructor(options) { | ||
super(options); | ||
@@ -80,7 +77,10 @@ /** | ||
} | ||
this.logger = (_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.instance) !== null && _b !== void 0 ? _b : new Logger_1.Logger((_d = (_c = options.logger) === null || _c === void 0 ? void 0 : _c.level) !== null && _d !== void 0 ? _d : 30 /* Info */); | ||
this.logger = options.logger?.instance ?? new Logger_1.Logger(options.logger?.level ?? 30 /* Info */); | ||
pieces_1.container.logger = this.logger; | ||
this.stores = new StoreRegistry_1.StoreRegistry(); | ||
if (options.enableLoaderTraceLoggings ?? pieces_1.container.logger.has(10 /* Trace */)) { | ||
pieces_1.Store.logger = pieces_1.container.logger.trace.bind(pieces_1.container.logger); | ||
} | ||
this.stores = new pieces_1.StoreRegistry(); | ||
pieces_1.container.stores = this.stores; | ||
this.fetchPrefix = (_e = options.fetchPrefix) !== null && _e !== void 0 ? _e : (() => { var _a; return (_a = this.options.defaultPrefix) !== null && _a !== void 0 ? _a : null; }); | ||
this.fetchPrefix = options.fetchPrefix ?? (() => this.options.defaultPrefix ?? null); | ||
for (const plugin of SapphireClient.plugins.values("preInitialization" /* PreInitialization */)) { | ||
@@ -90,10 +90,10 @@ plugin.hook.call(this, options); | ||
} | ||
this.id = (_f = options.id) !== null && _f !== void 0 ? _f : null; | ||
this.id = options.id ?? null; | ||
this.stores | ||
.register(new ArgumentStore_1.ArgumentStore().registerPath(path_1.join(__dirname, '..', 'arguments'))) // | ||
.register(new CommandStore_1.CommandStore()) | ||
.register(new EventStore_1.EventStore().registerPath(path_1.join(__dirname, '..', 'events'))) | ||
.register(new ListenerStore_1.ListenerStore().registerPath(path_1.join(__dirname, '..', 'listeners'))) | ||
.register(new PreconditionStore_1.PreconditionStore().registerPath(path_1.join(__dirname, '..', 'preconditions'))); | ||
if (options.loadDefaultErrorEvents !== false) | ||
this.stores.get('events').registerPath(path_1.join(__dirname, '..', 'errorEvents')); | ||
if (options.loadDefaultErrorListeners !== false) | ||
this.stores.get('listeners').registerPath(path_1.join(__dirname, '..', 'errorListeners')); | ||
for (const plugin of SapphireClient.plugins.values("postInitialization" /* PostInitialization */)) { | ||
@@ -113,3 +113,3 @@ plugin.hook.call(this, options); | ||
if (this.options.baseUserDirectory !== null) { | ||
this.stores.registerUserDirectories(this.options.baseUserDirectory); | ||
this.stores.registerPath(this.options.baseUserDirectory); | ||
} | ||
@@ -116,0 +116,0 @@ // Call pre-login plugins: |
@@ -7,4 +7,7 @@ "use strict"; | ||
const utilities_1 = require("@sapphire/utilities"); | ||
const discord_js_1 = require("discord.js"); | ||
const Lexure = tslib_1.__importStar(require("lexure")); | ||
const path_1 = require("path"); | ||
const Args_1 = require("../parsers/Args"); | ||
require("../types/Enums"); | ||
const PreconditionContainerArray_1 = require("../utils/preconditions/PreconditionContainerArray"); | ||
@@ -18,6 +21,14 @@ const FlagUnorderedStrategy_1 = require("../utils/strategies/FlagUnorderedStrategy"); | ||
*/ | ||
constructor(context, { name, ...options } = {}) { | ||
var _a, _b, _c; | ||
super(context, { ...options, name: (name !== null && name !== void 0 ? name : context.name).toLowerCase() }); | ||
constructor(context, options = {}) { | ||
super(context, { ...options, name: (options.name ?? context.name).toLowerCase() }); | ||
/** | ||
* The full category for the command. Either an array of strings that denote every (sub)folder the command is in, | ||
* or `null` if it could not be resolved automatically. | ||
* | ||
* If this is `null` for how you setup your code then you can overwrite how the `fullCategory` is resolved by | ||
* extending this class and overwriting the assignment in the constructor. | ||
* @since 2.0.0 | ||
*/ | ||
this.fullCategory = null; | ||
/** | ||
* The lexer to be used for command parsing | ||
@@ -28,6 +39,6 @@ * @since 1.0.0 | ||
this.lexer = new Lexure.Lexer(); | ||
this.description = (_a = options.description) !== null && _a !== void 0 ? _a : ''; | ||
this.detailedDescription = (_b = options.detailedDescription) !== null && _b !== void 0 ? _b : ''; | ||
this.strategy = new FlagUnorderedStrategy_1.FlagUnorderedStrategy(options.strategyOptions); | ||
this.lexer.setQuotes((_c = options.quotes) !== null && _c !== void 0 ? _c : [ | ||
this.description = options.description ?? ''; | ||
this.detailedDescription = options.detailedDescription ?? ''; | ||
this.strategy = new FlagUnorderedStrategy_1.FlagUnorderedStrategy(options); | ||
this.lexer.setQuotes(options.quotes ?? [ | ||
['"', '"'], | ||
@@ -37,2 +48,15 @@ ['β', 'β'], | ||
]); | ||
if (options.fullCategory) { | ||
this.fullCategory = options.fullCategory; | ||
} | ||
else { | ||
const commandsFolders = [...this.container.stores.get('commands').paths.values()].map((p) => p.split(path_1.sep).pop() ?? ''); | ||
const commandPath = context.path.split(path_1.sep); | ||
for (const commandFolder of commandsFolders) { | ||
if (commandPath.includes(commandFolder)) { | ||
this.fullCategory = commandPath.slice(commandPath.indexOf(commandFolder) + 1, -1); | ||
break; | ||
} | ||
} | ||
} | ||
if (options.generateDashLessAliases) { | ||
@@ -47,3 +71,4 @@ const dashLessAliases = []; | ||
} | ||
this.preconditions = new PreconditionContainerArray_1.PreconditionContainerArray(this.resolveConstructorPreConditions(options)); | ||
this.preconditions = new PreconditionContainerArray_1.PreconditionContainerArray(options.preconditions); | ||
this.parseConstructorPreConditions(options); | ||
} | ||
@@ -62,2 +87,38 @@ /** | ||
/** | ||
* Get all the main categories of commands. | ||
*/ | ||
get categories() { | ||
return Array.from(new Set([...this.container.stores.get('commands').values()].map(({ category }) => category))); | ||
} | ||
/** | ||
* The main category for the command, if any. | ||
* This is resolved from {@link Command.fullCategory}, which is automatically | ||
* resolved in the constructor. If you need different logic for category | ||
* then please first look into overwriting {@link Command.fullCategory} before | ||
* looking to overwrite this getter. | ||
*/ | ||
get category() { | ||
return (this.fullCategory?.length ?? 0) > 0 ? this.fullCategory?.[0] ?? null : null; | ||
} | ||
/** | ||
* The sub category for the command | ||
* This is resolved from {@link Command.fullCategory}, which is automatically | ||
* resolved in the constructor. If you need different logic for category | ||
* then please first look into overwriting {@link Command.fullCategory} before | ||
* looking to overwrite this getter. | ||
*/ | ||
get subCategory() { | ||
return (this.fullCategory?.length ?? 0) > 1 ? this.fullCategory?.[1] ?? null : null; | ||
} | ||
/** | ||
* The parent category for the command | ||
* This is resolved from {@link Command.fullCategory}, which is automatically | ||
* resolved in the constructor. If you need different logic for category | ||
* then please first look into overwriting {@link Command.fullCategory} before | ||
* looking to overwrite this getter. | ||
*/ | ||
get parentCategory() { | ||
return (this.fullCategory?.length ?? 0) > 0 ? this.fullCategory?.[(this.fullCategory?.length ?? 1) - 1] ?? null : null; | ||
} | ||
/** | ||
* Defines the JSON.stringify behavior of the command. | ||
@@ -70,19 +131,78 @@ */ | ||
detailedDescription: this.detailedDescription, | ||
category: this.category, | ||
strategy: this.strategy | ||
}; | ||
} | ||
resolveConstructorPreConditions(options) { | ||
var _a, _b, _c; | ||
const preconditions = (_b = (_a = options.preconditions) === null || _a === void 0 ? void 0 : _a.slice()) !== null && _b !== void 0 ? _b : []; | ||
/** | ||
* Parses the command's options and processes them, calling {@link Command#parseConstructorPreConditionsRunIn}, | ||
* {@link Command#parseConstructorPreConditionsNsfw}, | ||
* {@link Command#parseConstructorPreConditionsRequiredClientPermissions}, and | ||
* {@link Command#parseConstructorPreConditionsCooldown}. | ||
* @since 2.0.0 | ||
* @param options The command options given from the constructor. | ||
*/ | ||
parseConstructorPreConditions(options) { | ||
this.parseConstructorPreConditionsRunIn(options); | ||
this.parseConstructorPreConditionsNsfw(options); | ||
this.parseConstructorPreConditionsRequiredClientPermissions(options); | ||
this.parseConstructorPreConditionsRequiredUserPermissions(options); | ||
this.parseConstructorPreConditionsCooldown(options); | ||
} | ||
/** | ||
* Appends the `NSFW` precondition if {@link CommandOptions.nsfw} is set to true. | ||
* @param options The command options given from the constructor. | ||
*/ | ||
parseConstructorPreConditionsNsfw(options) { | ||
if (options.nsfw) | ||
preconditions.push("NSFW" /* NotSafeForWork */); | ||
this.preconditions.append("NSFW" /* NotSafeForWork */); | ||
} | ||
/** | ||
* Appends the `DMOnly`, `GuildOnly`, `NewsOnly`, and `TextOnly` preconditions based on the values passed in | ||
* {@link CommandOptions.runIn}, optimizing in specific cases (`NewsOnly` + `TextOnly` = `GuildOnly`; `DMOnly` + | ||
* `GuildOnly` = `null`), defaulting to `null`, which doesn't add a precondition. | ||
* @param options The command options given from the constructor. | ||
*/ | ||
parseConstructorPreConditionsRunIn(options) { | ||
const runIn = this.resolveConstructorPreConditionsRunType(options.runIn); | ||
if (runIn !== null) | ||
preconditions.push(runIn); | ||
const cooldownBucket = (_c = options.cooldownBucket) !== null && _c !== void 0 ? _c : 1; | ||
if (cooldownBucket && options.cooldownDuration) { | ||
preconditions.push({ name: "Cooldown" /* Cooldown */, context: { bucket: cooldownBucket, cooldown: options.cooldownDuration } }); | ||
this.preconditions.append(runIn); | ||
} | ||
/** | ||
* Appends the `ClientPermissions` precondition when {@link CommandOptions.requiredClientPermissions} resolves to a | ||
* non-zero bitfield. | ||
* @param options The command options given from the constructor. | ||
*/ | ||
parseConstructorPreConditionsRequiredClientPermissions(options) { | ||
const permissions = new discord_js_1.Permissions(options.requiredClientPermissions); | ||
if (permissions.bitfield !== 0n) { | ||
this.preconditions.append({ name: "ClientPermissions" /* ClientPermissions */, context: { permissions } }); | ||
} | ||
return preconditions; | ||
} | ||
/** | ||
* Appends the `UserPermissions` precondition when {@link CommandOptions.requiredUserPermissions} resolves to a | ||
* non-zero bitfield. | ||
* @param options The command options given from the constructor. | ||
*/ | ||
parseConstructorPreConditionsRequiredUserPermissions(options) { | ||
const permissions = new discord_js_1.Permissions(options.requiredUserPermissions); | ||
if (permissions.bitfield !== 0n) { | ||
this.preconditions.append({ name: "UserPermissions" /* UserPermissions */, context: { permissions } }); | ||
} | ||
} | ||
/** | ||
* Appends the `Cooldown` precondition when {@link CommandOptions.cooldownLimit} and | ||
* {@link CommandOptions.cooldownDelay} are both non-zero. | ||
* @param options The command options given from the constructor. | ||
*/ | ||
parseConstructorPreConditionsCooldown(options) { | ||
const limit = options.cooldownLimit ?? 1; | ||
const delay = options.cooldownDelay ?? 0; | ||
const filteredUsers = options.cooldownFilteredUsers; | ||
if (limit && delay) { | ||
this.preconditions.append({ | ||
name: "Cooldown" /* Cooldown */, | ||
context: { scope: options.cooldownScope ?? 3 /* User */, limit, delay, filteredUsers } | ||
}); | ||
} | ||
} | ||
resolveConstructorPreConditionsRunType(runIn) { | ||
@@ -93,10 +213,16 @@ if (utilities_1.isNullish(runIn)) | ||
switch (runIn) { | ||
case 'dm': | ||
return ["DMOnly" /* DirectMessageOnly */]; | ||
case 'text': | ||
return ["TextOnly" /* TextOnly */]; | ||
case 'news': | ||
return ["NewsOnly" /* NewsOnly */]; | ||
case 'guild': | ||
return ["GuildOnly" /* GuildOnly */]; | ||
case 'DM': | ||
return "DMOnly" /* DirectMessageOnly */; | ||
case 'GUILD_TEXT': | ||
return "GuildTextOnly" /* GuildTextOnly */; | ||
case 'GUILD_NEWS': | ||
return "GuildNewsOnly" /* GuildNewsOnly */; | ||
case 'GUILD_NEWS_THREAD': | ||
return "GuildNewsThreadOnly" /* GuildNewsThreadOnly */; | ||
case 'GUILD_PUBLIC_THREAD': | ||
return "GuildPublicThreadOnly" /* GuildPublicThreadOnly */; | ||
case 'GUILD_PRIVATE_THREAD': | ||
return "GuildPrivateThreadOnly" /* GuildPrivateThreadOnly */; | ||
case 'GUILD_ANY': | ||
return "GuildOnly" /* GuildOnly */; | ||
default: | ||
@@ -110,19 +236,47 @@ return null; | ||
} | ||
const dm = runIn.includes('dm'); | ||
const text = runIn.includes('text'); | ||
const news = runIn.includes('news'); | ||
const guild = text && news; | ||
if (runIn.length === 1) { | ||
return this.resolveConstructorPreConditionsRunType(runIn[0]); | ||
} | ||
const keys = new Set(runIn); | ||
const dm = keys.has('DM'); | ||
const guildText = keys.has('GUILD_TEXT'); | ||
const guildNews = keys.has('GUILD_NEWS'); | ||
const guild = guildText && guildNews; | ||
// If runs everywhere, optimise to null: | ||
if (dm && guild) | ||
return null; | ||
const array = []; | ||
const guildPublicThread = keys.has('GUILD_PUBLIC_THREAD'); | ||
const guildPrivateThread = keys.has('GUILD_PRIVATE_THREAD'); | ||
const guildNewsThread = keys.has('GUILD_NEWS_THREAD'); | ||
const guildThreads = guildPublicThread && guildPrivateThread && guildNewsThread; | ||
// If runs in any thread, optimise to thread-only: | ||
if (guildThreads && keys.size === 3) { | ||
return "GuildThreadOnly" /* GuildThreadOnly */; | ||
} | ||
const preconditions = new PreconditionContainerArray_1.PreconditionContainerArray(); | ||
if (dm) | ||
array.push("DMOnly" /* DirectMessageOnly */); | ||
if (guild) | ||
array.push("GuildOnly" /* GuildOnly */); | ||
else if (text) | ||
array.push("TextOnly" /* TextOnly */); | ||
else if (news) | ||
array.push("NewsOnly" /* NewsOnly */); | ||
return array; | ||
preconditions.append("DMOnly" /* DirectMessageOnly */); | ||
if (guild) { | ||
preconditions.append("GuildOnly" /* GuildOnly */); | ||
} | ||
else { | ||
// GuildText includes PublicThread and PrivateThread | ||
if (guildText) { | ||
preconditions.append("GuildTextOnly" /* GuildTextOnly */); | ||
} | ||
else { | ||
if (guildPublicThread) | ||
preconditions.append("GuildPublicThreadOnly" /* GuildPublicThreadOnly */); | ||
if (guildPrivateThread) | ||
preconditions.append("GuildPrivateThreadOnly" /* GuildPrivateThreadOnly */); | ||
} | ||
// GuildNews includes NewsThread | ||
if (guildNews) { | ||
preconditions.append("GuildNewsOnly" /* GuildNewsOnly */); | ||
} | ||
else if (guildNewsThread) { | ||
preconditions.append("GuildNewsThreadOnly" /* GuildNewsThreadOnly */); | ||
} | ||
} | ||
return preconditions; | ||
} | ||
@@ -138,8 +292,14 @@ } | ||
CommandPreConditions["Cooldown"] = "Cooldown"; | ||
CommandPreConditions["NotSafeForWork"] = "NSFW"; | ||
CommandPreConditions["DirectMessageOnly"] = "DMOnly"; | ||
CommandPreConditions["TextOnly"] = "TextOnly"; | ||
CommandPreConditions["NewsOnly"] = "NewsOnly"; | ||
CommandPreConditions["GuildNewsOnly"] = "GuildNewsOnly"; | ||
CommandPreConditions["GuildNewsThreadOnly"] = "GuildNewsThreadOnly"; | ||
CommandPreConditions["GuildOnly"] = "GuildOnly"; | ||
CommandPreConditions["GuildPrivateThreadOnly"] = "GuildPrivateThreadOnly"; | ||
CommandPreConditions["GuildPublicThreadOnly"] = "GuildPublicThreadOnly"; | ||
CommandPreConditions["GuildTextOnly"] = "GuildTextOnly"; | ||
CommandPreConditions["GuildThreadOnly"] = "GuildThreadOnly"; | ||
CommandPreConditions["NotSafeForWork"] = "NSFW"; | ||
CommandPreConditions["ClientPermissions"] = "ClientPermissions"; | ||
CommandPreConditions["UserPermissions"] = "UserPermissions"; | ||
})(CommandPreConditions = exports.CommandPreConditions || (exports.CommandPreConditions = {})); | ||
//# sourceMappingURL=Command.js.map |
@@ -9,5 +9,4 @@ "use strict"; | ||
constructor(context, options = {}) { | ||
var _a; | ||
super(context, options); | ||
this.position = (_a = options.position) !== null && _a !== void 0 ? _a : null; | ||
this.position = options.position ?? null; | ||
} | ||
@@ -14,0 +13,0 @@ ok() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BucketType = exports.PluginHook = exports.CooldownLevel = void 0; | ||
exports.BucketScope = exports.PluginHook = exports.CooldownLevel = void 0; | ||
var CooldownLevel; | ||
@@ -19,23 +19,23 @@ (function (CooldownLevel) { | ||
/** | ||
* The level the cooldown applies to | ||
* The scope the cooldown applies to. | ||
*/ | ||
var BucketType; | ||
(function (BucketType) { | ||
var BucketScope; | ||
(function (BucketScope) { | ||
/** | ||
* Per channel cooldowns | ||
* Per channel cooldowns. | ||
*/ | ||
BucketType[BucketType["Channel"] = 0] = "Channel"; | ||
BucketScope[BucketScope["Channel"] = 0] = "Channel"; | ||
/** | ||
* Global cooldowns | ||
* Global cooldowns. | ||
*/ | ||
BucketType[BucketType["Global"] = 1] = "Global"; | ||
BucketScope[BucketScope["Global"] = 1] = "Global"; | ||
/** | ||
* Per guild cooldowns | ||
* Per guild cooldowns. | ||
*/ | ||
BucketType[BucketType["Guild"] = 2] = "Guild"; | ||
BucketScope[BucketScope["Guild"] = 2] = "Guild"; | ||
/** | ||
* Per user cooldowns | ||
* Per user cooldowns. | ||
*/ | ||
BucketType[BucketType["User"] = 3] = "User"; | ||
})(BucketType = exports.BucketType || (exports.BucketType = {})); | ||
BucketScope[BucketScope["User"] = 3] = "User"; | ||
})(BucketScope = exports.BucketScope || (exports.BucketScope = {})); | ||
//# sourceMappingURL=Enums.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Events = void 0; | ||
var Events; | ||
(function (Events) { | ||
const discord_js_1 = require("discord.js"); | ||
exports.Events = { | ||
// #region Discord.js base events | ||
Events["ChannelCreate"] = "channelCreate"; | ||
Events["ChannelDelete"] = "channelDelete"; | ||
Events["ChannelPinsUpdate"] = "channelPinsUpdate"; | ||
Events["ChannelUpdate"] = "channelUpdate"; | ||
Events["Debug"] = "debug"; | ||
Events["Warn"] = "warn"; | ||
Events["Disconnect"] = "disconnect"; | ||
Events["EmojiCreate"] = "emojiCreate"; | ||
Events["EmojiDelete"] = "emojiDelete"; | ||
Events["EmojiUpdate"] = "emojiUpdate"; | ||
Events["Error"] = "error"; | ||
Events["GuildBanAdd"] = "guildBanAdd"; | ||
Events["GuildBanRemove"] = "guildBanRemove"; | ||
Events["GuildCreate"] = "guildCreate"; | ||
Events["GuildDelete"] = "guildDelete"; | ||
Events["GuildUnavailable"] = "guildUnavailable"; | ||
Events["GuildIntegrationsUpdate"] = "guildIntegrationsUpdate"; | ||
Events["GuildMemberAdd"] = "guildMemberAdd"; | ||
Events["GuildMemberAvailable"] = "guildMemberAvailable"; | ||
Events["GuildMemberRemove"] = "guildMemberRemove"; | ||
Events["GuildMembersChunk"] = "guildMembersChunk"; | ||
Events["GuildMemberSpeaking"] = "guildMemberSpeaking"; | ||
Events["GuildMemberUpdate"] = "guildMemberUpdate"; | ||
Events["GuildUpdate"] = "guildUpdate"; | ||
Events["InviteCreate"] = "inviteCreate"; | ||
Events["InviteDelete"] = "inviteDelete"; | ||
Events["Message"] = "message"; | ||
Events["MessageDelete"] = "messageDelete"; | ||
Events["MessageReactionRemoveAll"] = "messageReactionRemoveAll"; | ||
Events["MessageReactionRemoveEmoji"] = "messageReactionRemoveEmoji"; | ||
Events["MessageDeleteBulk"] = "messageDeleteBulk"; | ||
Events["MessageReactionAdd"] = "messageReactionAdd"; | ||
Events["MessageReactionRemove"] = "messageReactionRemove"; | ||
Events["MessageUpdate"] = "messageUpdate"; | ||
Events["PresenceUpdate"] = "presenceUpdate"; | ||
Events["RateLimit"] = "rateLimit"; | ||
Events["Ready"] = "ready"; | ||
Events["Invalidated"] = "invalidated"; | ||
Events["RoleCreate"] = "roleCreate"; | ||
Events["RoleDelete"] = "roleDelete"; | ||
Events["RoleUpdate"] = "roleUpdate"; | ||
Events["TypingsStart"] = "typingStart"; | ||
Events["UserUpdate"] = "userUpdate"; | ||
Events["VoiceStateUpdate"] = "voiceStateUpdate"; | ||
Events["WebhookUpdate"] = "webhookUpdate"; | ||
Events["ShardDisconnect"] = "shardDisconnect"; | ||
Events["ShardError"] = "shardError"; | ||
Events["ShardReady"] = "shardReady"; | ||
Events["ShardReconnecting"] = "shardReconnecting"; | ||
Events["ShardResume"] = "shardResume"; | ||
ChannelCreate: discord_js_1.Constants.Events.CHANNEL_CREATE, | ||
ChannelDelete: discord_js_1.Constants.Events.CHANNEL_DELETE, | ||
ChannelPinsUpdate: discord_js_1.Constants.Events.CHANNEL_PINS_UPDATE, | ||
ChannelUpdate: discord_js_1.Constants.Events.CHANNEL_UPDATE, | ||
ClientReady: discord_js_1.Constants.Events.CLIENT_READY, | ||
Debug: discord_js_1.Constants.Events.DEBUG, | ||
Error: discord_js_1.Constants.Events.ERROR, | ||
GuildBanAdd: discord_js_1.Constants.Events.GUILD_BAN_ADD, | ||
GuildBanRemove: discord_js_1.Constants.Events.GUILD_BAN_REMOVE, | ||
GuildCreate: discord_js_1.Constants.Events.GUILD_CREATE, | ||
GuildDelete: discord_js_1.Constants.Events.GUILD_DELETE, | ||
GuildEmojiCreate: discord_js_1.Constants.Events.GUILD_EMOJI_CREATE, | ||
GuildEmojiDelete: discord_js_1.Constants.Events.GUILD_EMOJI_DELETE, | ||
GuildEmojiUpdate: discord_js_1.Constants.Events.GUILD_EMOJI_UPDATE, | ||
GuildIntegrationsUpdate: discord_js_1.Constants.Events.GUILD_INTEGRATIONS_UPDATE, | ||
GuildMemberAdd: discord_js_1.Constants.Events.GUILD_MEMBER_ADD, | ||
GuildMemberAvailable: discord_js_1.Constants.Events.GUILD_MEMBER_AVAILABLE, | ||
GuildMemberRemove: discord_js_1.Constants.Events.GUILD_MEMBER_REMOVE, | ||
GuildMemberUpdate: discord_js_1.Constants.Events.GUILD_MEMBER_UPDATE, | ||
GuildMembersChunk: discord_js_1.Constants.Events.GUILD_MEMBERS_CHUNK, | ||
GuildRoleCreate: discord_js_1.Constants.Events.GUILD_ROLE_CREATE, | ||
GuildRoleDelete: discord_js_1.Constants.Events.GUILD_ROLE_DELETE, | ||
GuildRoleUpdate: discord_js_1.Constants.Events.GUILD_ROLE_UPDATE, | ||
GuildUnavailable: discord_js_1.Constants.Events.GUILD_UNAVAILABLE, | ||
GuildUpdate: discord_js_1.Constants.Events.GUILD_UPDATE, | ||
Invalidated: discord_js_1.Constants.Events.INVALIDATED, | ||
InviteCreate: discord_js_1.Constants.Events.INVITE_CREATE, | ||
InviteDelete: discord_js_1.Constants.Events.INVITE_DELETE, | ||
MessageBulkDelete: discord_js_1.Constants.Events.MESSAGE_BULK_DELETE, | ||
MessageCreate: discord_js_1.Constants.Events.MESSAGE_CREATE, | ||
MessageDelete: discord_js_1.Constants.Events.MESSAGE_DELETE, | ||
MessageReactionAdd: discord_js_1.Constants.Events.MESSAGE_REACTION_ADD, | ||
MessageReactionRemoveAll: discord_js_1.Constants.Events.MESSAGE_REACTION_REMOVE_ALL, | ||
MessageReactionRemove: discord_js_1.Constants.Events.MESSAGE_REACTION_REMOVE, | ||
MessageUpdate: discord_js_1.Constants.Events.MESSAGE_UPDATE, | ||
PresenceUpdate: discord_js_1.Constants.Events.PRESENCE_UPDATE, | ||
RateLimit: discord_js_1.Constants.Events.RATE_LIMIT, | ||
Raw: discord_js_1.Constants.Events.RAW, | ||
ShardDisconnect: discord_js_1.Constants.Events.SHARD_DISCONNECT, | ||
ShardError: discord_js_1.Constants.Events.SHARD_ERROR, | ||
ShardReady: discord_js_1.Constants.Events.SHARD_READY, | ||
ShardReconnecting: discord_js_1.Constants.Events.SHARD_RECONNECTING, | ||
ShardResume: discord_js_1.Constants.Events.SHARD_RESUME, | ||
TypingStart: discord_js_1.Constants.Events.TYPING_START, | ||
UserUpdate: discord_js_1.Constants.Events.USER_UPDATE, | ||
VoiceStateUpdate: discord_js_1.Constants.Events.VOICE_STATE_UPDATE, | ||
Warn: discord_js_1.Constants.Events.WARN, | ||
WebhooksUpdate: discord_js_1.Constants.Events.WEBHOOKS_UPDATE, | ||
// #endregion Discord.js base events | ||
// #region Sapphire load cycle events | ||
Events["PieceUnload"] = "pieceUnload"; | ||
Events["PiecePostLoad"] = "piecePostLoad"; | ||
Events["MentionPrefixOnly"] = "mentionPrefixOnly"; | ||
Events["EventError"] = "eventError"; | ||
Events["PreMessageParsed"] = "preMessageParsed"; | ||
Events["PrefixedMessage"] = "prefixedMessage"; | ||
Events["UnknownCommandName"] = "unknownCommandName"; | ||
Events["UnknownCommand"] = "unknownCommand"; | ||
Events["PreCommandRun"] = "preCommandRun"; | ||
Events["CommandDenied"] = "commandDenied"; | ||
Events["CommandAccepted"] = "commandAccepted"; | ||
Events["CommandRun"] = "commandRun"; | ||
Events["CommandSuccess"] = "commandSuccess"; | ||
Events["CommandFinish"] = "commandFinish"; | ||
Events["CommandError"] = "commandError"; | ||
Events["PluginLoaded"] = "pluginLoaded"; | ||
Events["NonPrefixedMessage"] = "nonPrefixedMessage"; | ||
CommandAccepted: 'commandAccepted', | ||
CommandDenied: 'commandDenied', | ||
CommandError: 'commandError', | ||
CommandFinish: 'commandFinish', | ||
CommandRun: 'commandRun', | ||
CommandSuccess: 'commandSuccess', | ||
ListenerError: 'listenerError', | ||
MentionPrefixOnly: 'mentionPrefixOnly', | ||
NonPrefixedMessage: 'nonPrefixedMessage', | ||
PiecePostLoad: 'piecePostLoad', | ||
PieceUnload: 'pieceUnload', | ||
PluginLoaded: 'pluginLoaded', | ||
PreCommandRun: 'preCommandRun', | ||
PrefixedMessage: 'prefixedMessage', | ||
PreMessageParsed: 'preMessageParsed', | ||
UnknownCommand: 'unknownCommand', | ||
UnknownCommandName: 'unknownCommandName' | ||
// #endregion Sapphire load cycle events | ||
})(Events = exports.Events || (exports.Events = {})); | ||
}; | ||
//# sourceMappingURL=Events.js.map |
@@ -9,2 +9,5 @@ "use strict"; | ||
} | ||
has(level) { | ||
return level >= this.level; | ||
} | ||
trace(...values) { | ||
@@ -29,3 +32,3 @@ this.write(10 /* Trace */, ...values); | ||
write(level, ...values) { | ||
if (level < this.level) | ||
if (!this.has(level)) | ||
return; | ||
@@ -32,0 +35,0 @@ const method = Logger.levels.get(level); |
@@ -19,9 +19,8 @@ "use strict"; | ||
async parallel(message, command, entries, context) { | ||
var _a; | ||
const results = await Promise.all(entries.map((entry) => entry.run(message, command, context))); | ||
// This is simplified compared to PreconditionContainerAny because we're looking for the first error. | ||
// However, the base implementation short-circuits with the first Ok. | ||
return (_a = results.find(Result_1.isErr)) !== null && _a !== void 0 ? _a : Result_1.ok(); | ||
return results.find(Result_1.isErr) ?? Result_1.ok(); | ||
} | ||
}; | ||
//# sourceMappingURL=PreconditionConditionAnd.js.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
} | ||
return error !== null && error !== void 0 ? error : Result_1.ok(); | ||
return error ?? Result_1.ok(); | ||
}, | ||
@@ -29,5 +29,5 @@ async parallel(message, command, entries, context) { | ||
} | ||
return error !== null && error !== void 0 ? error : Result_1.ok(); | ||
return error ?? Result_1.ok(); | ||
} | ||
}; | ||
//# sourceMappingURL=PreconditionConditionOr.js.map |
@@ -67,8 +67,7 @@ "use strict"; | ||
constructor(data = [], parent = null) { | ||
var _a; | ||
this.entries = []; | ||
this.runCondition = (parent === null || parent === void 0 ? void 0 : parent.runCondition) === PreconditionRunCondition.And ? PreconditionRunCondition.Or : PreconditionRunCondition.And; | ||
this.runCondition = parent?.runCondition === PreconditionRunCondition.And ? PreconditionRunCondition.Or : PreconditionRunCondition.And; | ||
if (Array.isArray(data)) { | ||
const casted = data; | ||
this.mode = (_a = parent === null || parent === void 0 ? void 0 : parent.mode) !== null && _a !== void 0 ? _a : 0 /* Sequential */; | ||
this.mode = parent?.mode ?? 0 /* Sequential */; | ||
this.parse(casted); | ||
@@ -91,2 +90,6 @@ } | ||
} | ||
append(entry) { | ||
this.entries.push(entry instanceof PreconditionContainerArray ? entry : new PreconditionContainerSingle_1.PreconditionContainerSingle(entry)); | ||
return this; | ||
} | ||
/** | ||
@@ -93,0 +96,0 @@ * Runs the container. |
@@ -16,3 +16,3 @@ "use strict"; | ||
else { | ||
this.context = data.context; | ||
this.context = Reflect.get(data, 'context') ?? {}; | ||
this.name = data.name; | ||
@@ -19,0 +19,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FlagUnorderedStrategy = void 0; | ||
const never = () => null; | ||
const always = () => true; | ||
class FlagUnorderedStrategy { | ||
constructor({ flags = [], options = [], prefixes = ['--', '-', 'β'], separators = ['=', ':'] } = {}) { | ||
this.flags = flags; | ||
this.options = options; | ||
constructor({ flags, options, prefixes = ['--', '-', 'β'], separators = ['=', ':'] } = {}) { | ||
this.flags = flags || []; | ||
this.options = options || []; | ||
this.prefixes = prefixes; | ||
this.separators = separators; | ||
if (this.flags === true) | ||
this.allowedFlag = always; | ||
else if (this.flags.length === 0) | ||
this.matchFlag = never; | ||
if (this.options === true) { | ||
this.allowedOption = always; | ||
} | ||
else if (this.options.length === 0) { | ||
this.matchOption = never; | ||
this.matchCompactOption = never; | ||
} | ||
} | ||
@@ -20,3 +33,3 @@ matchFlag(s) { | ||
// The flag must be an allowed one. | ||
if (this.flags.includes(s)) | ||
if (this.allowedFlag(s)) | ||
return s; | ||
@@ -35,3 +48,3 @@ // If it did not match a flag, return null. | ||
s = s.slice(0, -separator.length); | ||
if (this.options.includes(s)) | ||
if (this.allowedOption(s)) | ||
return s; | ||
@@ -52,3 +65,3 @@ return null; | ||
const k = s.slice(0, i); | ||
if (!this.options.includes(k)) | ||
if (!this.allowedOption(k)) | ||
return null; | ||
@@ -58,4 +71,10 @@ const v = s.slice(i + sep.length); | ||
} | ||
allowedFlag(s) { | ||
return this.flags.includes(s); | ||
} | ||
allowedOption(s) { | ||
return this.options.includes(s); | ||
} | ||
} | ||
exports.FlagUnorderedStrategy = FlagUnorderedStrategy; | ||
//# sourceMappingURL=FlagUnorderedStrategy.js.map |
@@ -20,7 +20,9 @@ "use strict"; | ||
return this.ok(); | ||
const bucket = this.getBucket(command, context); | ||
const remaining = bucket.take(this.getID(message, context)); | ||
return remaining === 0 | ||
? this.ok() | ||
: this.error({ | ||
// If the user has provided any filtered users and the message author is in that array, return ok: | ||
if (context.filteredUsers?.includes(message.author.id)) | ||
return this.ok(); | ||
const ratelimit = this.getManager(command, context).acquire(this.getId(message, context)); | ||
if (ratelimit.limited) { | ||
const remaining = ratelimit.remainingTime; | ||
return this.error({ | ||
identifier: "preconditionCooldown" /* PreconditionCooldown */, | ||
@@ -30,5 +32,8 @@ message: `You have just used this command. Try again in ${Math.ceil(remaining / 1000)} second${remaining > 1000 ? 's' : ''}.`, | ||
}); | ||
} | ||
ratelimit.consume(); | ||
return this.ok(); | ||
} | ||
getID(message, context) { | ||
switch (context.bucketType) { | ||
getId(message, context) { | ||
switch (context.scope) { | ||
case 1 /* Global */: | ||
@@ -39,3 +44,3 @@ return 'global'; | ||
case 2 /* Guild */: | ||
return message.guild.id; | ||
return message.guild?.id ?? message.channel.id; | ||
default: | ||
@@ -45,14 +50,9 @@ return message.author.id; | ||
} | ||
getBucket(command, context) { | ||
var _a; | ||
let bucket = this.buckets.get(command); | ||
if (!bucket) { | ||
bucket = new ratelimits_1.Bucket(); | ||
if (((_a = context.limit) !== null && _a !== void 0 ? _a : 1) <= 1) | ||
bucket.setDelay(context.delay); | ||
else | ||
bucket.setLimit({ timespan: context.delay, maximum: context.limit }); | ||
this.buckets.set(command, bucket); | ||
getManager(command, context) { | ||
let manager = this.buckets.get(command); | ||
if (!manager) { | ||
manager = new ratelimits_1.RateLimitManager(context.delay, context.limit); | ||
this.buckets.set(command, manager); | ||
} | ||
return bucket; | ||
return manager; | ||
} | ||
@@ -59,0 +59,0 @@ } |
{ | ||
"name": "@sapphire/framework", | ||
"version": "2.0.0-next.1e9359f1.0", | ||
"version": "2.0.0-next.1ea447f1.0", | ||
"description": "Discord bot framework built on top of @sapphire/lib for advanced and amazing bots.", | ||
@@ -17,9 +17,4 @@ "main": "dist/index.js", | ||
"update": "yarn upgrade-interactive --latest", | ||
"build": "run-s build:tsc", | ||
"build:cleanup": "node scripts/clean-dist.mjs", | ||
"build:tsc": "tsc -b src", | ||
"build:rollup-bundle": "rollup -c scripts/rollup.bundle.ts", | ||
"build:rollup-types": "rollup -c scripts/rollup.types.ts", | ||
"build:clean-extraneous-types": "node scripts/clean-extraneous-types.mjs", | ||
"clean": "yarn build:cleanup", | ||
"clean": "node scripts/clean-dist.mjs", | ||
"build": "tsc -b src && rollup -c scripts/rollup.bundle.ts", | ||
"watch": "tsc -b src -w", | ||
@@ -29,41 +24,40 @@ "sversion": "standard-version", | ||
"cz": "git-cz", | ||
"prepublishOnly": "run-s build:**", | ||
"prepublishOnly": "rollup-type-bundler -e url events", | ||
"prepare": "husky install .github/husky" | ||
}, | ||
"dependencies": { | ||
"@sapphire/discord-utilities": "^2.1.4", | ||
"@sapphire/discord.js-utilities": "^1.5.10", | ||
"@sapphire/pieces": "~2.0.0", | ||
"@sapphire/ratelimits": "^1.2.3", | ||
"@sapphire/utilities": "^1.6.0", | ||
"@sapphire/discord-utilities": "^2.1.5", | ||
"@sapphire/discord.js-utilities": "next", | ||
"@sapphire/pieces": "^2.1.0", | ||
"@sapphire/ratelimits": "^2.0.1", | ||
"@sapphire/utilities": "^2.0.1", | ||
"lexure": "^0.17.0", | ||
"tslib": "^2.3.0" | ||
"tslib": "^2.3.1" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^12.1.4", | ||
"@commitlint/config-conventional": "^12.1.4", | ||
"@mdx-js/mdx": "^1.6.22", | ||
"@sapphire/eslint-config": "^3.2.0", | ||
"@sapphire/prettier-config": "^1.1.4", | ||
"@sapphire/ts-config": "^2.3.0", | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.12.4", | ||
"@types/ws": "^7.4.5", | ||
"@commitlint/cli": "^13.1.0", | ||
"@commitlint/config-conventional": "^13.1.0", | ||
"@favware/npm-deprecate": "^1.0.2", | ||
"@favware/rollup-type-bundler": "^1.0.3", | ||
"@sapphire/eslint-config": "^3.2.3", | ||
"@sapphire/prettier-config": "^1.1.6", | ||
"@sapphire/ts-config": "^3.0.0", | ||
"@types/jest": "^27.0.1", | ||
"@types/node": "^16.6.2", | ||
"@types/ws": "^7.4.7", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"discord.js": "^12.5.3", | ||
"husky": "^6.0.0", | ||
"jest": "^27.0.4", | ||
"jest-circus": "^27.0.4", | ||
"lint-staged": "^11.0.0", | ||
"npm-run-all": "^4.1.5", | ||
"discord.js": "^13.1.0", | ||
"husky": "^7.0.1", | ||
"jest": "^27.0.6", | ||
"jest-circus": "^27.0.6", | ||
"lint-staged": "^11.1.2", | ||
"pretty-quick": "^3.1.1", | ||
"rollup": "^2.51.2", | ||
"rollup-plugin-dts": "^3.0.2", | ||
"rollup": "^2.56.2", | ||
"rollup-plugin-version-injector": "^1.3.3", | ||
"standard-version": "^9.3.0", | ||
"ts-jest": "^27.0.3", | ||
"ts-node": "^10.0.0", | ||
"typedoc": "^0.21.0", | ||
"standard-version": "^9.3.1", | ||
"ts-jest": "^27.0.4", | ||
"ts-node": "^10.1.0", | ||
"typedoc": "^0.21.5", | ||
"typedoc-plugin-nojekyll": "^1.0.1", | ||
"typescript": "^4.3.4" | ||
"typescript": "^4.3.5" | ||
}, | ||
@@ -112,3 +106,3 @@ "repository": { | ||
"resolutions": { | ||
"acorn": "^8.4.0", | ||
"acorn": "^8.4.1", | ||
"minimist": "^1.2.5", | ||
@@ -120,3 +114,3 @@ "kind-of": "^6.0.3", | ||
"lodash": "^4.17.21", | ||
"marked": "^2.1.1", | ||
"marked": "^2.1.3", | ||
"merge": "^2.1.1", | ||
@@ -123,0 +117,0 @@ "trim": "^1.0.1", |
@@ -27,3 +27,3 @@ <div align="center"> | ||
- Written in TypeScript | ||
- Command Handler, Arguments, Pre-conditions and Events Store | ||
- Command Handler, Arguments, Pre-conditions and Listeners Store | ||
- Completely Modular and Extendable | ||
@@ -73,21 +73,22 @@ - Advanced Plugins Support | ||
<tr> | ||
<td align="center"><a href="https://github.com/kyranet"><img src="https://avatars0.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antonio RomΓ‘n</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=kyranet" title="Code">π»</a> <a href="https://github.com/sapphi/sapphiredev/its?author=kyranet" title="Documentation">π</a> <a href="#design-kyranet" title="Design">π¨</a> <a href="#ideas-kyranet" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-kyranet" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-kyranet" title="Project Management">π</a> <a href="#plugin-kyranet" title="Plugin/utility libraries">π</a></td> | ||
<td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=Favna" title="Code">π»</a> <a href="https://github.com/sapphi/sapphiredev/its?author=Favna" title="Documentation">π</a> <a href="#infra-Favna" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-Favna" title="Project Management">π</a> <a href="#plugin-Favna" title="Plugin/utility libraries">π</a></td> | ||
<td align="center"><a href="https://github.com/cfanoulis"><img src="https://avatars3.githubusercontent.com/u/38255093?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Charalampos Fanoulis</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=cfanoulis" title="Code">π»</a></td> | ||
<td align="center"><a href="http://www.adityatd.me"><img src="https://avatars0.githubusercontent.com/u/9266227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aditya N. Tripathi</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=AdityaTD" title="Code">π»</a> <a href="https://github.com/sapphi/sapphiredev/its?author=AdityaTD" title="Documentation">π</a></td> | ||
<td align="center"><a href="http://leonard.pw"><img src="https://avatars1.githubusercontent.com/u/35312043?v=4?s=100" width="100px;" alt=""/><br /><sub><b>LeonardSSH</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=LeonardSSH" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://quantumlytangled.com/"><img src="https://avatars1.githubusercontent.com/u/7919610?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nejc DrobniΔ</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=QuantumlyTangled" title="Code">π»</a> <a href="#plugin-QuantumlyTangled" title="Plugin/utility libraries">π</a></td> | ||
<td align="center"><a href="https://github.com/Phamzito"><img src="https://avatars2.githubusercontent.com/u/31642521?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Gustavo Herrera De La Cruz</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=Phamzito" title="Code">π»</a></td> | ||
<td align="center"><a href="https://github.com/kyranet"><img src="https://avatars0.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antonio RomΓ‘n</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=kyranet" title="Code">π»</a> <a href="https://github.com/sapphiredev/framework/commits?author=kyranet" title="Documentation">π</a> <a href="#design-kyranet" title="Design">π¨</a> <a href="#ideas-kyranet" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-kyranet" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-kyranet" title="Project Management">π</a> <a href="#plugin-kyranet" title="Plugin/utility libraries">π</a></td> | ||
<td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=Favna" title="Code">π»</a> <a href="https://github.com/sapphiredev/framework/commits?author=Favna" title="Documentation">π</a> <a href="#infra-Favna" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#projectManagement-Favna" title="Project Management">π</a> <a href="#plugin-Favna" title="Plugin/utility libraries">π</a></td> | ||
<td align="center"><a href="https://github.com/cfanoulis"><img src="https://avatars3.githubusercontent.com/u/38255093?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Charalampos Fanoulis</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=cfanoulis" title="Code">π»</a></td> | ||
<td align="center"><a href="http://www.adityatd.me"><img src="https://avatars0.githubusercontent.com/u/9266227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aditya N. Tripathi</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=AdityaTD" title="Code">π»</a> <a href="https://github.com/sapphiredev/framework/commits?author=AdityaTD" title="Documentation">π</a></td> | ||
<td align="center"><a href="http://leonard.pw"><img src="https://avatars1.githubusercontent.com/u/35312043?v=4?s=100" width="100px;" alt=""/><br /><sub><b>LeonardSSH</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=LeonardSSH" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://quantumlytangled.com/"><img src="https://avatars1.githubusercontent.com/u/7919610?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nejc DrobniΔ</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=QuantumlyTangled" title="Code">π»</a> <a href="#plugin-QuantumlyTangled" title="Plugin/utility libraries">π</a></td> | ||
<td align="center"><a href="https://github.com/Phamzito"><img src="https://avatars2.githubusercontent.com/u/31642521?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Gustavo Herrera De La Cruz</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=Phamzito" title="Code">π»</a></td> | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://github.com/Rexogamer"><img src="https://avatars0.githubusercontent.com/u/42586271?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ed L</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=Rexogamer" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://atm.moe/"><img src="https://avatars3.githubusercontent.com/u/31011461?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kovacs Alex</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=alexthemaster" title="Code">π»</a></td> | ||
<td align="center"><a href="https://github.com/Alcremie"><img src="https://avatars0.githubusercontent.com/u/54785334?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Lieder</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=Alcremie" title="Code">π»</a> <a href="https://github.com/sapphi/sapphiredev/s?q=is%3Apr+reviewed-by%3AAlcremie" title="Reviewed Pull Requests">π</a></td> | ||
<td align="center"><a href="https://github.com/Nytelife26"><img src="https://avatars1.githubusercontent.com/u/22531310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler J Russell</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=Nytelife26" title="Code">π»</a> <a href="#infra-Nytelife26" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#plugin-Nytelife26" title="Plugin/utility libraries">π</a></td> | ||
<td align="center"><a href="https://github.com/Soumil07"><img src="https://avatars0.githubusercontent.com/u/29275227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Soumil07</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=Soumil07" title="Code">π»</a></td> | ||
<td align="center"><a href="https://lavya.tech/"><img src="https://avatars.githubusercontent.com/u/65386243?v=4?s=100" width="100px;" alt=""/><br /><sub><b>lavgup</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=lavgup" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://github.com/vladfrangu"><img src="https://avatars.githubusercontent.com/u/17960496?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Frangu</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=vladfrangu" title="Code">π»</a> <a href="#infra-vladfrangu" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="https://github.com/sapphi/sapphiredev/s?q=is%3Apr+reviewed-by%3Avladfrangu" title="Reviewed Pull Requests">π</a></td> | ||
<td align="center"><a href="https://github.com/Rexogamer"><img src="https://avatars0.githubusercontent.com/u/42586271?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ed L</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=Rexogamer" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://atm.moe/"><img src="https://avatars3.githubusercontent.com/u/31011461?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kovacs Alex</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=alexthemaster" title="Code">π»</a></td> | ||
<td align="center"><a href="https://github.com/Alcremie"><img src="https://avatars0.githubusercontent.com/u/54785334?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Lieder</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=Alcremie" title="Code">π»</a> <a href="https://github.com/sapphiredev/framework/pulls?q=is%3Apr+reviewed-by%3AAlcremie" title="Reviewed Pull Requests">π</a></td> | ||
<td align="center"><a href="https://github.com/Nytelife26"><img src="https://avatars1.githubusercontent.com/u/22531310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler J Russell</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=Nytelife26" title="Code">π»</a> <a href="#infra-Nytelife26" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#plugin-Nytelife26" title="Plugin/utility libraries">π</a></td> | ||
<td align="center"><a href="https://github.com/Soumil07"><img src="https://avatars0.githubusercontent.com/u/29275227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Soumil07</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=Soumil07" title="Code">π»</a></td> | ||
<td align="center"><a href="https://lavya.tech/"><img src="https://avatars.githubusercontent.com/u/65386243?v=4?s=100" width="100px;" alt=""/><br /><sub><b>lavgup</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=lavgup" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://github.com/vladfrangu"><img src="https://avatars.githubusercontent.com/u/17960496?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Frangu</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=vladfrangu" title="Code">π»</a> <a href="#infra-vladfrangu" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="https://github.com/sapphiredev/framework/pulls?q=is%3Apr+reviewed-by%3Avladfrangu" title="Reviewed Pull Requests">π</a></td> | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://github.com/noftaly"><img src="https://avatars.githubusercontent.com/u/34779161?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Elliot</b></sub></a><br /><a href="https://github.com/sapphiredev/rk/commits?author=noftaly" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://github.com/noftaly"><img src="https://avatars.githubusercontent.com/u/34779161?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Elliot</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=noftaly" title="Documentation">π</a></td> | ||
<td align="center"><a href="https://kaname.netlify.app"><img src="https://avatars.githubusercontent.com/u/56084970?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kaname</b></sub></a><br /><a href="https://github.com/sapphiredev/framework/commits?author=kaname-png" title="Code">π»</a> <a href="https://github.com/sapphiredev/framework/issues?q=author%3Akaname-png" title="Bug reports">π</a></td> | ||
</tr> | ||
@@ -94,0 +95,0 @@ </table> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
356804
25
210
6048
103
4
+ Added@discordjs/collection@0.2.4(transitive)
+ Added@sapphire/discord-utilities@3.4.4(transitive)
+ Added@sapphire/discord.js-utilities@7.3.3-next.a0809c46(transitive)
+ Added@sapphire/duration@1.1.4(transitive)
+ Added@sapphire/pieces@2.2.0(transitive)
+ Added@sapphire/ratelimits@2.4.11(transitive)
+ Added@sapphire/utilities@2.0.13.18.2(transitive)
+ Addeddiscord-api-types@0.37.119(transitive)
- Removed@discordjs/collection@0.1.6(transitive)
- Removed@sapphire/discord.js-utilities@1.6.0(transitive)
- Removed@sapphire/pieces@2.0.0(transitive)
- Removed@sapphire/ratelimits@1.2.5(transitive)
- Removed@sapphire/utilities@1.7.0(transitive)
Updated@sapphire/pieces@^2.1.0
Updated@sapphire/ratelimits@^2.0.1
Updated@sapphire/utilities@^2.0.1
Updatedtslib@^2.3.1