@sapphire/framework
Advanced tools
Comparing version 2.0.0-pr-218.ee962943.0 to 2.0.0-pr-244.8672a8bd.0
@@ -12,3 +12,2 @@ "use strict"; | ||
run(parameter, context) { | ||
var _a; | ||
const { guild } = context.message; | ||
@@ -23,3 +22,3 @@ if (!guild) { | ||
} | ||
const channel = (_a = this.resolveByID(parameter, guild)) !== null && _a !== void 0 ? _a : this.resolveByQuery(parameter, guild); | ||
const channel = this.resolveById(parameter, guild) ?? this.resolveByQuery(parameter, guild); | ||
return channel | ||
@@ -33,11 +32,9 @@ ? this.ok(channel) | ||
} | ||
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; | ||
resolveById(argument, guild) { | ||
const channelId = discord_utilities_1.ChannelMentionRegex.exec(argument) ?? discord_utilities_1.SnowflakeRegex.exec(argument); | ||
return channelId ? guild.channels.cache.get(channelId[1]) ?? 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; | ||
return guild.channels.cache.find((channel) => channel.name.toLowerCase() === lowerCaseArgument) ?? null; | ||
} | ||
@@ -44,0 +41,0 @@ } |
@@ -12,3 +12,2 @@ "use strict"; | ||
async run(parameter, context) { | ||
var _a; | ||
const { guild } = context.message; | ||
@@ -23,3 +22,3 @@ if (!guild) { | ||
} | ||
const member = (_a = (await this.resolveByID(parameter, guild))) !== null && _a !== void 0 ? _a : (await this.resolveByQuery(parameter, guild)); | ||
const member = (await this.resolveById(parameter, guild)) ?? (await this.resolveByQuery(parameter, guild)); | ||
return member | ||
@@ -33,9 +32,7 @@ ? this.ok(member) | ||
} | ||
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 resolveById(argument, guild) { | ||
const memberId = discord_utilities_1.UserOrMemberMentionRegex.exec(argument) ?? 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 | ||
@@ -47,3 +44,3 @@ .fetch({ | ||
.catch(() => null); | ||
return (_a = members === null || members === void 0 ? void 0 : members.first()) !== null && _a !== void 0 ? _a : null; | ||
return members?.first() ?? null; | ||
} | ||
@@ -50,0 +47,0 @@ } |
@@ -12,5 +12,4 @@ "use strict"; | ||
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)); | ||
const channel = context.channel ?? context.message.channel; | ||
const message = (await this.resolveById(parameter, channel)) ?? (await this.resolveByLink(parameter, context)); | ||
return message | ||
@@ -24,7 +23,6 @@ ? this.ok(message) | ||
} | ||
async resolveByID(argument, channel) { | ||
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) | ||
@@ -35,7 +33,7 @@ return null; | ||
return null; | ||
const [, guildID, channelID, messageID] = matches; | ||
const guild = this.container.client.guilds.cache.get(guildID); | ||
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); | ||
const channel = guild.channels.cache.get(channelId); | ||
if (!channel) | ||
@@ -47,5 +45,5 @@ return null; | ||
return null; | ||
if (!((_a = channel.permissionsFor(message.author)) === null || _a === void 0 ? void 0 : _a.has(discord_js_1.Permissions.FLAGS.VIEW_CHANNEL))) | ||
if (!channel.permissionsFor(message.author)?.has(discord_js_1.Permissions.FLAGS.VIEW_CHANNEL)) | ||
return null; | ||
return channel.messages.fetch(messageID).catch(() => null); | ||
return channel.messages.fetch(messageId).catch(() => null); | ||
} | ||
@@ -52,0 +50,0 @@ } |
@@ -12,3 +12,2 @@ "use strict"; | ||
async run(parameter, context) { | ||
var _a; | ||
const { guild } = context.message; | ||
@@ -23,14 +22,12 @@ if (!guild) { | ||
} | ||
const role = (_a = (await this.resolveByID(parameter, guild))) !== null && _a !== void 0 ? _a : this.resolveByQuery(parameter, guild); | ||
const role = (await this.resolveById(parameter, guild)) ?? this.resolveByQuery(parameter, guild); | ||
return role ? this.ok(role) : this.error({ parameter, message: 'The argument did not resolve to a role.', context }); | ||
} | ||
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; | ||
async resolveById(argument, guild) { | ||
const roleId = discord_utilities_1.RoleMentionRegex.exec(argument) ?? 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; | ||
return guild.roles.cache.find((role) => role.name.toLowerCase() === lowerCaseArgument) ?? null; | ||
} | ||
@@ -37,0 +34,0 @@ } |
@@ -11,5 +11,4 @@ "use strict"; | ||
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; | ||
const userId = discord_utilities_1.UserOrMemberMentionRegex.exec(parameter) ?? 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 }); | ||
@@ -16,0 +15,0 @@ } |
@@ -1,6 +0,6 @@ | ||
/* Version: 2.0.0-pr-218.ee962943.0 - July 5, 2021 01:37:21 */ | ||
/* Version: 2.0.0-pr-244.8672a8bd.0 - August 11, 2021 18:09:34 */ | ||
'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.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); | ||
@@ -31,8 +32,7 @@ tslib_1.__exportStar(require("./lib/errors/Identifiers"), exports); | ||
tslib_1.__exportStar(require("./lib/structures/CommandStore"), 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/ExtendedArgument"), 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); | ||
@@ -49,2 +49,2 @@ tslib_1.__exportStar(require("./lib/types/Events"), exports); | ||
tslib_1.__exportStar(require("./lib/utils/preconditions/PreconditionContainerSingle"), exports); | ||
exports.version = '2.0.0-pr-218.ee962943.0'; | ||
exports.version = '2.0.0-pr-244.8672a8bd.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; |
@@ -41,8 +41,12 @@ "use strict"; | ||
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["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, |
@@ -12,3 +12,2 @@ "use strict"; | ||
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,3 +90,3 @@ plugin.hook.call(this, options); | ||
} | ||
this.id = (_f = options.id) !== null && _f !== void 0 ? _f : null; | ||
this.id = options.id ?? null; | ||
this.stores | ||
@@ -113,3 +113,3 @@ .register(new ArgumentStore_1.ArgumentStore().registerPath(path_1.join(__dirname, '..', 'arguments'))) // | ||
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,32 @@ /** | ||
/** | ||
* 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. | ||
@@ -73,16 +128,61 @@ */ | ||
} | ||
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.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 `Permissions` 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: "Permissions" /* Permissions */, context: { permissions } }); | ||
} | ||
return preconditions; | ||
} | ||
/** | ||
* 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; | ||
if (limit && delay) { | ||
this.preconditions.append({ | ||
name: "Cooldown" /* Cooldown */, | ||
context: { scope: options.cooldownScope ?? 3 /* User */, limit, delay } | ||
}); | ||
} | ||
} | ||
resolveConstructorPreConditionsRunType(runIn) { | ||
@@ -93,10 +193,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 +216,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 +272,13 @@ } | ||
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["Permissions"] = "Permissions"; | ||
})(CommandPreConditions = exports.CommandPreConditions || (exports.CommandPreConditions = {})); | ||
//# sourceMappingURL=Command.js.map |
"use strict"; | ||
var _Listener_listener; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Listener = void 0; | ||
const tslib_1 = require("tslib"); | ||
const pieces_1 = require("@sapphire/pieces"); | ||
@@ -49,21 +47,37 @@ const Events_1 = require("../types/Events"); | ||
constructor(context, options = {}) { | ||
var _a, _b, _c; | ||
super(context, options); | ||
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility | ||
_Listener_listener.set(this, void 0); | ||
this.emitter = | ||
typeof options.emitter === 'undefined' | ||
? this.container.client | ||
: (_a = (typeof options.emitter === 'string' ? Reflect.get(this.container.client, options.emitter) : options.emitter)) !== null && _a !== void 0 ? _a : null; | ||
this.event = (_b = options.event) !== null && _b !== void 0 ? _b : this.name; | ||
this.once = (_c = options.once) !== null && _c !== void 0 ? _c : false; | ||
tslib_1.__classPrivateFieldSet(this, _Listener_listener, this.emitter && this.event ? (this.once ? this._runOnce.bind(this) : this._run.bind(this)) : null, "f"); | ||
: (typeof options.emitter === 'string' ? Reflect.get(this.container.client, options.emitter) : options.emitter) ?? | ||
null; | ||
this.event = options.event ?? this.name; | ||
this.once = options.once ?? false; | ||
this._listener = this.emitter && this.event ? (this.once ? this._runOnce.bind(this) : this._run.bind(this)) : null; | ||
// If there's no emitter or no listener, disable: | ||
if (this.emitter === null || this._listener === null) | ||
this.enabled = false; | ||
} | ||
onLoad() { | ||
if (tslib_1.__classPrivateFieldGet(this, _Listener_listener, "f")) | ||
this.emitter[this.once ? 'once' : 'on'](this.event, tslib_1.__classPrivateFieldGet(this, _Listener_listener, "f")); | ||
if (this._listener) { | ||
const emitter = this.emitter; | ||
// Increment the maximum amount of listeners by one: | ||
const maxListeners = emitter.getMaxListeners(); | ||
if (maxListeners !== 0) | ||
emitter.setMaxListeners(maxListeners + 1); | ||
emitter[this.once ? 'once' : 'on'](this.event, this._listener); | ||
} | ||
return super.onLoad(); | ||
} | ||
onUnload() { | ||
if (!this.once && tslib_1.__classPrivateFieldGet(this, _Listener_listener, "f")) | ||
this.emitter.off(this.event, tslib_1.__classPrivateFieldGet(this, _Listener_listener, "f")); | ||
if (!this.once && this._listener) { | ||
const emitter = this.emitter; | ||
// Increment the maximum amount of listeners by one: | ||
const maxListeners = emitter.getMaxListeners(); | ||
if (maxListeners !== 0) | ||
emitter.setMaxListeners(maxListeners - 1); | ||
emitter.off(this.event, this._listener); | ||
this._listener = null; | ||
} | ||
return super.onUnload(); | ||
} | ||
@@ -73,2 +87,3 @@ toJSON() { | ||
...super.toJSON(), | ||
once: this.once, | ||
event: this.event | ||
@@ -87,7 +102,6 @@ }; | ||
await this._run(...args); | ||
await this.store.unload(this); | ||
await this.unload(); | ||
} | ||
} | ||
exports.Listener = Listener; | ||
_Listener_listener = new WeakMap(); | ||
//# sourceMappingURL=Listener.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 |
@@ -13,3 +13,2 @@ "use strict"; | ||
Debug: discord_js_1.Constants.Events.DEBUG, | ||
Disconnect: discord_js_1.Constants.Events.DISCONNECT, | ||
Error: discord_js_1.Constants.Events.ERROR, | ||
@@ -27,3 +26,2 @@ GuildBanAdd: discord_js_1.Constants.Events.GUILD_BAN_ADD, | ||
GuildMemberRemove: discord_js_1.Constants.Events.GUILD_MEMBER_REMOVE, | ||
GuildMemberSpeaking: discord_js_1.Constants.Events.GUILD_MEMBER_SPEAKING, | ||
GuildMemberUpdate: discord_js_1.Constants.Events.GUILD_MEMBER_UPDATE, | ||
@@ -49,4 +47,2 @@ GuildMembersChunk: discord_js_1.Constants.Events.GUILD_MEMBERS_CHUNK, | ||
Raw: discord_js_1.Constants.Events.RAW, | ||
Reconnecting: discord_js_1.Constants.Events.RECONNECTING, | ||
Resumed: discord_js_1.Constants.Events.RESUMED, | ||
ShardDisconnect: discord_js_1.Constants.Events.SHARD_DISCONNECT, | ||
@@ -53,0 +49,0 @@ ShardError: discord_js_1.Constants.Events.SHARD_ERROR, |
@@ -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 |
@@ -12,3 +12,3 @@ "use strict"; | ||
// Stop bots and webhooks from running commands. | ||
if (message.author.bot || message.webhookID) | ||
if (message.author.bot || message.webhookId) | ||
return; | ||
@@ -15,0 +15,0 @@ // Run the message parser. |
@@ -28,3 +28,3 @@ "use strict"; | ||
} | ||
else if (regexPrefix === null || regexPrefix === void 0 ? void 0 : regexPrefix.test(message.content)) { | ||
else if (regexPrefix?.test(message.content)) { | ||
prefix = regexPrefix; | ||
@@ -44,6 +44,5 @@ } | ||
async canRunInChannel(message) { | ||
var _a; | ||
if (message.channel.type === 'dm') | ||
if (message.channel.type === 'DM') | ||
return true; | ||
const me = (_a = message.guild.me) !== null && _a !== void 0 ? _a : (message.client.id ? await message.guild.members.fetch(message.client.id) : null); | ||
const me = message.guild.me ?? (message.client.id ? await message.guild.members.fetch(message.client.id) : null); | ||
if (!me) | ||
@@ -70,4 +69,4 @@ return false; | ||
// Check whether or not the ID is the same as the client ID: | ||
const mentionID = content.substr(idOffset, idLength); | ||
if (mentionID === id) | ||
const mentionId = content.substr(idOffset, idLength); | ||
if (mentionId === id) | ||
return content.substr(0, idOffset + idLength + 1); | ||
@@ -77,3 +76,2 @@ return null; | ||
getPrefix(content, prefixes) { | ||
var _a; | ||
if (prefixes === null) | ||
@@ -87,3 +85,3 @@ return null; | ||
} | ||
return (_a = prefixes.find((prefix) => content.startsWith(caseInsensitivePrefixes ? prefix.toLowerCase() : prefix))) !== null && _a !== void 0 ? _a : null; | ||
return prefixes.find((prefix) => content.startsWith(caseInsensitivePrefixes ? prefix.toLowerCase() : prefix)) ?? null; | ||
} | ||
@@ -90,0 +88,0 @@ } |
@@ -11,5 +11,4 @@ "use strict"; | ||
run() { | ||
var _a, _b, _c; | ||
var _d; | ||
(_a = (_d = this.container.client).id) !== null && _a !== void 0 ? _a : (_d.id = (_c = (_b = this.container.client.user) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : null); | ||
var _a; | ||
(_a = this.container.client).id ?? (_a.id = this.container.client.user?.id ?? null); | ||
} | ||
@@ -16,0 +15,0 @@ } |
@@ -20,7 +20,6 @@ "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({ | ||
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 +29,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 +41,3 @@ return 'global'; | ||
case 2 /* Guild */: | ||
return message.guild.id; | ||
return message.guild?.id ?? message.channel.id; | ||
default: | ||
@@ -45,14 +47,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 +56,0 @@ } |
@@ -23,7 +23,5 @@ "use strict"; | ||
run(message, _command, context) { | ||
var _a; | ||
const required = (_a = context.permissions) !== null && _a !== void 0 ? _a : new discord_js_1.Permissions(0); | ||
const permissions = message.guild | ||
? message.channel.permissionsFor(message.client.id) | ||
: this.dmChannelPermissions; | ||
const required = context.permissions ?? new discord_js_1.Permissions(); | ||
const channel = message.channel; | ||
const permissions = message.guild ? channel.permissionsFor(message.client.id) : this.dmChannelPermissions; | ||
const missing = permissions.missing(required); | ||
@@ -43,34 +41,40 @@ return missing.length === 0 | ||
CorePrecondition.readablePermissions = { | ||
ADD_REACTIONS: 'Add Reactions', | ||
ADMINISTRATOR: 'Administrator', | ||
VIEW_AUDIT_LOG: 'View Audit Log', | ||
MANAGE_GUILD: 'Manage Server', | ||
MANAGE_ROLES: 'Manage Roles', | ||
MANAGE_CHANNELS: 'Manage Channels', | ||
KICK_MEMBERS: 'Kick Members', | ||
ATTACH_FILES: 'Attach Files', | ||
BAN_MEMBERS: 'Ban Members', | ||
CHANGE_NICKNAME: 'Change Nickname', | ||
CONNECT: 'Connect', | ||
CREATE_INSTANT_INVITE: 'Create Instant Invite', | ||
CHANGE_NICKNAME: 'Change Nickname', | ||
DEAFEN_MEMBERS: 'Deafen Members', | ||
EMBED_LINKS: 'Embed Links', | ||
KICK_MEMBERS: 'Kick Members', | ||
MANAGE_CHANNELS: 'Manage Channels', | ||
MANAGE_EMOJIS_AND_STICKERS: 'Manage Emojis and Stickers', | ||
MANAGE_GUILD: 'Manage Server', | ||
MANAGE_MESSAGES: 'Manage Messages', | ||
MANAGE_NICKNAMES: 'Manage Nicknames', | ||
MANAGE_EMOJIS: 'Manage Emojis', | ||
MANAGE_ROLES: 'Manage Roles', | ||
MANAGE_THREADS: 'Manage Threads', | ||
MANAGE_WEBHOOKS: 'Manage Webhooks', | ||
VIEW_CHANNEL: 'Read Messages', | ||
MENTION_EVERYONE: 'Mention Everyone', | ||
MOVE_MEMBERS: 'Move Members', | ||
MUTE_MEMBERS: 'Mute Members', | ||
PRIORITY_SPEAKER: 'Priority Speaker', | ||
READ_MESSAGE_HISTORY: 'Read Message History', | ||
REQUEST_TO_SPEAK: 'Request to Speak', | ||
SEND_MESSAGES: 'Send Messages', | ||
SEND_TTS_MESSAGES: 'Send TTS Messages', | ||
MANAGE_MESSAGES: 'Manage Messages', | ||
EMBED_LINKS: 'Embed Links', | ||
ATTACH_FILES: 'Attach Files', | ||
READ_MESSAGE_HISTORY: 'Read Message History', | ||
MENTION_EVERYONE: 'Mention Everyone', | ||
USE_EXTERNAL_EMOJIS: 'Use External Emojis', | ||
ADD_REACTIONS: 'Add Reactions', | ||
CONNECT: 'Connect', | ||
SPEAK: 'Speak', | ||
STREAM: 'Stream', | ||
MUTE_MEMBERS: 'Mute Members', | ||
DEAFEN_MEMBERS: 'Deafen Members', | ||
MOVE_MEMBERS: 'Move Members', | ||
USE_APPLICATION_COMMANDS: 'Use Application Commands', | ||
USE_EXTERNAL_EMOJIS: 'Use External Emojis', | ||
USE_EXTERNAL_STICKERS: 'Use External Stickers', | ||
USE_PRIVATE_THREADS: 'Use Private Threads', | ||
USE_PUBLIC_THREADS: 'Use Public Threads', | ||
USE_VAD: 'Use Voice Activity', | ||
PRIORITY_SPEAKER: 'Priority Speaker', | ||
VIEW_AUDIT_LOG: 'View Audit Log', | ||
VIEW_CHANNEL: 'Read Messages', | ||
VIEW_GUILD_INSIGHTS: 'View Guild Insights' | ||
}; | ||
//# sourceMappingURL=Permissions.js.map |
{ | ||
"name": "@sapphire/framework", | ||
"version": "2.0.0-pr-218.ee962943.0", | ||
"version": "2.0.0-pr-244.8672a8bd.0", | ||
"description": "Discord bot framework built on top of @sapphire/lib for advanced and amazing bots.", | ||
@@ -28,6 +28,6 @@ "main": "dist/index.js", | ||
"@sapphire/discord-utilities": "^2.1.5", | ||
"@sapphire/discord.js-utilities": "^1.6.0", | ||
"@sapphire/pieces": "~2.0.0", | ||
"@sapphire/ratelimits": "^1.2.5", | ||
"@sapphire/utilities": "^1.6.1", | ||
"@sapphire/discord.js-utilities": "next", | ||
"@sapphire/pieces": "^2.1.0", | ||
"@sapphire/ratelimits": "^2.0.1", | ||
"@sapphire/utilities": "^2.0.1", | ||
"lexure": "^0.17.0", | ||
@@ -37,24 +37,24 @@ "tslib": "^2.3.0" | ||
"devDependencies": { | ||
"@commitlint/cli": "^12.1.4", | ||
"@commitlint/config-conventional": "^12.1.4", | ||
"@favware/rollup-type-bundler": "^1.0.2", | ||
"@sapphire/eslint-config": "^3.2.1", | ||
"@commitlint/cli": "^13.1.0", | ||
"@commitlint/config-conventional": "^13.1.0", | ||
"@favware/rollup-type-bundler": "^1.0.3", | ||
"@sapphire/eslint-config": "^3.2.3", | ||
"@sapphire/prettier-config": "^1.1.6", | ||
"@sapphire/ts-config": "^2.3.1", | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^16.0.0", | ||
"@types/ws": "^7.4.6", | ||
"@sapphire/ts-config": "^3.0.0", | ||
"@types/jest": "^26.0.24", | ||
"@types/node": "^16.4.13", | ||
"@types/ws": "^7.4.7", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"discord.js": "^12.5.3", | ||
"husky": "^7.0.0", | ||
"discord.js": "^13.0.0", | ||
"husky": "^7.0.1", | ||
"jest": "^27.0.6", | ||
"jest-circus": "^27.0.6", | ||
"lint-staged": "^11.0.0", | ||
"lint-staged": "^11.1.2", | ||
"pretty-quick": "^3.1.1", | ||
"rollup": "^2.52.7", | ||
"rollup": "^2.56.0", | ||
"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.2", | ||
"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", | ||
@@ -105,3 +105,3 @@ "typescript": "^4.3.5" | ||
"resolutions": { | ||
"acorn": "^8.4.0", | ||
"acorn": "^8.4.1", | ||
"minimist": "^1.2.5", | ||
@@ -113,3 +113,3 @@ "kind-of": "^6.0.3", | ||
"lodash": "^4.17.21", | ||
"marked": "^2.1.1", | ||
"marked": "^2.1.3", | ||
"merge": "^2.1.1", | ||
@@ -116,0 +116,0 @@ "trim": "^1.0.1", |
@@ -72,21 +72,22 @@ <div align="center"> | ||
<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> | ||
@@ -93,0 +94,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 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
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
303855
156
5321
103
+ 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