@sapphire/plugin-pattern-commands 6.0.4-next.ebf804c → 6.0.4-next.edf5e96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ var PluginPreCommandRun_cjs = require('./listeners/PluginPreCommandRun.cjs');
10
10
  var _load_cjs = require('./listeners/_load.cjs');
11
11
 
12
12
  // src/index.ts
13
- var version = "6.0.4-next.ebf804c";
13
+ var version = "6.0.4-next.edf5e96";
14
14
 
15
15
  Object.defineProperty(exports, "PluginPatternCommandsCommandAcceptedListener", {
16
16
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAyBO,IAAM,OAAkB,GAAA","file":"index.cjs","sourcesContent":["import type { PatternCommandStore } from './lib/structures/PatternCommandStore';\n\nexport * from './lib/structures/PatternCommandStore';\nexport * from './lib/structures/PatternCommand';\nexport * from './lib/utils/PatternCommandEvents';\nexport * from './lib/utils/PatternCommandInterfaces';\nexport { PluginListener as PluginPatternCommandsCommandAcceptedListener } from './listeners/PluginCommandAccepted';\nexport { PluginListener as PluginPatternCommandsMessageParseListener } from './listeners/PluginMessageParse';\nexport { PluginListener as PluginPatternCommandsPreCommandRunListener } from './listeners/PluginPreCommandRun';\n\nexport { loadListeners } from './listeners/_load';\n\ndeclare module '@sapphire/pieces' {\n\tinterface StoreRegistryEntries {\n\t\t'pattern-commands': PatternCommandStore;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-pattern-commands](https://github.com/sapphiredev/plugins/blob/main/packages/pattern-commands) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '6.0.4-next.ebf804c';\n"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAyBO,IAAM,OAAA,GAAkB","file":"index.cjs","sourcesContent":["import type { PatternCommandStore } from './lib/structures/PatternCommandStore';\n\nexport * from './lib/structures/PatternCommandStore';\nexport * from './lib/structures/PatternCommand';\nexport * from './lib/utils/PatternCommandEvents';\nexport * from './lib/utils/PatternCommandInterfaces';\nexport { PluginListener as PluginPatternCommandsCommandAcceptedListener } from './listeners/PluginCommandAccepted';\nexport { PluginListener as PluginPatternCommandsMessageParseListener } from './listeners/PluginMessageParse';\nexport { PluginListener as PluginPatternCommandsPreCommandRunListener } from './listeners/PluginPreCommandRun';\n\nexport { loadListeners } from './listeners/_load';\n\ndeclare module '@sapphire/pieces' {\n\tinterface StoreRegistryEntries {\n\t\t'pattern-commands': PatternCommandStore;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-pattern-commands](https://github.com/sapphiredev/plugins/blob/main/packages/pattern-commands) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '6.0.4-next.edf5e96';\n"]}
@@ -1,5 +1,5 @@
1
1
  import { AliasStore } from '@sapphire/pieces';
2
- import { MessageCommand, Command, Args, Listener, Events } from '@sapphire/framework';
2
+ import { Command, Args, MessageCommand, Listener, Events } from '@sapphire/framework';
3
3
  import { Message, Awaitable } from 'discord.js';
4
4
 
5
5
  interface PatternCommandOptions extends MessageCommand.Options {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/structures/PatternCommand.ts"],"names":["Command"],"mappings":";;;;;;;;AAGO,IAAe,eAAA,GAAf,MAAe,eAAA,SAAuBA,iBAAsC,CAAA;AAAA,EAI3E,WAAA,CAAY,SAAuC,OAAiC,EAAA;AAC1F,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AAJvB,IAAgB,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA;AAChB,IAAgB,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA;AAChB,IAAgB,aAAA,CAAA,IAAA,EAAA,eAAA,CAAA;AAGf,IAAK,IAAA,CAAA,MAAA,GAAS,QAAQ,MAAU,IAAA,GAAA;AAChC,IAAA,IAAI,QAAQ,MAAQ,EAAA;AACnB,MAAI,IAAA,OAAA,CAAQ,SAAS,CAAG,EAAA;AACvB,QAAA,IAAA,CAAK,MAAS,GAAA,CAAA;AAAA,OACf,MAAA,IAAW,OAAQ,CAAA,MAAA,GAAS,EAAI,EAAA;AAC/B,QAAA,IAAA,CAAK,MAAS,GAAA,EAAA;AAAA,OACR,MAAA;AACN,QAAA,IAAA,CAAK,SAAS,OAAQ,CAAA,MAAA;AAAA;AACvB,KACM,MAAA;AACN,MAAA,IAAA,CAAK,MAAS,GAAA,CAAA;AAAA;AAEf,IAAK,IAAA,CAAA,aAAA,GAAgB,QAAQ,aAAiB,IAAA,KAAA;AAAA;AAQhD,CAAA;AA1BmF,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAA5E,IAAe,cAAf,GAAA","file":"PatternCommand.cjs","sourcesContent":["import { Args, Command, type MessageCommand } from '@sapphire/framework';\nimport type { Awaitable, Message } from 'discord.js';\n\nexport abstract class PatternCommand extends Command<Args, PatternCommand.Options> {\n\tpublic readonly chance: number;\n\tpublic readonly weight: number;\n\tpublic readonly matchFullName: boolean;\n\tpublic constructor(context: PatternCommand.LoaderContext, options: PatternCommand.Options) {\n\t\tsuper(context, options);\n\t\tthis.chance = options.chance ?? 100;\n\t\tif (options.weight) {\n\t\t\tif (options.weight < 0) {\n\t\t\t\tthis.weight = 0;\n\t\t\t} else if (options.weight > 10) {\n\t\t\t\tthis.weight = 10;\n\t\t\t} else {\n\t\t\t\tthis.weight = options.weight;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.weight = 5;\n\t\t}\n\t\tthis.matchFullName = options.matchFullName ?? false;\n\t}\n\n\t/**\n\t * Executes the pattern command's logic.\n\t * @param message The message that triggered the pattern command.\n\t */\n\tpublic abstract override messageRun(message: Message): Awaitable<unknown>;\n}\n\nexport interface PatternCommandOptions extends MessageCommand.Options {\n\t/**\n\t * The chance that the pattern command is triggered.\n\t * @default 100\n\t */\n\tchance?: number;\n\t/**\n\t * The matching weight of the command.\n\t * @default 5\n\t */\n\tweight?: number;\n\t/**\n\t * If true it will only trigger on full matches (for example, explore won't trigger lore)\n\t * Note: It will only change the behavior of the command's name and not for the command's aliasses\n\t * @default false\n\t */\n\tmatchFullName?: boolean;\n}\n\nexport namespace PatternCommand {\n\t/**\n\t * Re-export of {@link MessageCommand.LoaderContext}\n\t * @deprecated Use {@linkcode LoaderContext} instead.\n\t */\n\texport type Context = LoaderContext;\n\texport type LoaderContext = MessageCommand.LoaderContext;\n\n\t/** Re-export of {@link MessageCommand.RunContext} */\n\texport type RunContext = MessageCommand.RunContext;\n\n\t/** Re-export of {@link MessageCommand.JSON} */\n\texport type JSON = MessageCommand.JSON;\n\n\t/** Re-export of {@link MessageCommand.RunInTypes} */\n\texport type RunInTypes = MessageCommand.RunInTypes;\n\n\t/**\n\t * The PatternCommand Options\n\t */\n\texport type Options = PatternCommandOptions;\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/structures/PatternCommand.ts"],"names":["Command"],"mappings":";;;;;;;;AAGO,IAAe,eAAA,GAAf,MAAe,eAAA,SAAuBA,iBAAA,CAAsC;AAAA,EAI3E,WAAA,CAAY,SAAuC,OAAA,EAAiC;AAC1F,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AAJvB,IAAA,aAAA,CAAA,IAAA,EAAgB,QAAA,CAAA;AAChB,IAAA,aAAA,CAAA,IAAA,EAAgB,QAAA,CAAA;AAChB,IAAA,aAAA,CAAA,IAAA,EAAgB,eAAA,CAAA;AAGf,IAAA,IAAA,CAAK,MAAA,GAAS,QAAQ,MAAA,IAAU,GAAA;AAChC,IAAA,IAAI,QAAQ,MAAA,EAAQ;AACnB,MAAA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACvB,QAAA,IAAA,CAAK,MAAA,GAAS,CAAA;AAAA,MACf,CAAA,MAAA,IAAW,OAAA,CAAQ,MAAA,GAAS,EAAA,EAAI;AAC/B,QAAA,IAAA,CAAK,MAAA,GAAS,EAAA;AAAA,MACf,CAAA,MAAO;AACN,QAAA,IAAA,CAAK,SAAS,OAAA,CAAQ,MAAA;AAAA,MACvB;AAAA,IACD,CAAA,MAAO;AACN,MAAA,IAAA,CAAK,MAAA,GAAS,CAAA;AAAA,IACf;AACA,IAAA,IAAA,CAAK,aAAA,GAAgB,QAAQ,aAAA,IAAiB,KAAA;AAAA,EAC/C;AAOD,CAAA;AA1BmF,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAA5E,IAAe,cAAA,GAAf","file":"PatternCommand.cjs","sourcesContent":["import { Args, Command, type MessageCommand } from '@sapphire/framework';\nimport type { Awaitable, Message } from 'discord.js';\n\nexport abstract class PatternCommand extends Command<Args, PatternCommand.Options> {\n\tpublic readonly chance: number;\n\tpublic readonly weight: number;\n\tpublic readonly matchFullName: boolean;\n\tpublic constructor(context: PatternCommand.LoaderContext, options: PatternCommand.Options) {\n\t\tsuper(context, options);\n\t\tthis.chance = options.chance ?? 100;\n\t\tif (options.weight) {\n\t\t\tif (options.weight < 0) {\n\t\t\t\tthis.weight = 0;\n\t\t\t} else if (options.weight > 10) {\n\t\t\t\tthis.weight = 10;\n\t\t\t} else {\n\t\t\t\tthis.weight = options.weight;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.weight = 5;\n\t\t}\n\t\tthis.matchFullName = options.matchFullName ?? false;\n\t}\n\n\t/**\n\t * Executes the pattern command's logic.\n\t * @param message The message that triggered the pattern command.\n\t */\n\tpublic abstract override messageRun(message: Message): Awaitable<unknown>;\n}\n\nexport interface PatternCommandOptions extends MessageCommand.Options {\n\t/**\n\t * The chance that the pattern command is triggered.\n\t * @default 100\n\t */\n\tchance?: number;\n\t/**\n\t * The matching weight of the command.\n\t * @default 5\n\t */\n\tweight?: number;\n\t/**\n\t * If true it will only trigger on full matches (for example, explore won't trigger lore)\n\t * Note: It will only change the behavior of the command's name and not for the command's aliasses\n\t * @default false\n\t */\n\tmatchFullName?: boolean;\n}\n\nexport namespace PatternCommand {\n\t/**\n\t * Re-export of {@link MessageCommand.LoaderContext}\n\t * @deprecated Use {@linkcode LoaderContext} instead.\n\t */\n\texport type Context = LoaderContext;\n\texport type LoaderContext = MessageCommand.LoaderContext;\n\n\t/** Re-export of {@link MessageCommand.RunContext} */\n\texport type RunContext = MessageCommand.RunContext;\n\n\t/** Re-export of {@link MessageCommand.JSON} */\n\texport type JSON = MessageCommand.JSON;\n\n\t/** Re-export of {@link MessageCommand.RunInTypes} */\n\texport type RunInTypes = MessageCommand.RunInTypes;\n\n\t/**\n\t * The PatternCommand Options\n\t */\n\texport type Options = PatternCommandOptions;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/structures/PatternCommandStore.ts"],"names":["AliasStore","PatternCommand"],"mappings":";;;;;;;AAGO,IAAM,oBAAA,GAAN,MAAM,oBAAA,SAA4BA,iBAA2B,CAAA;AAAA,EAC5D,WAAc,GAAA;AACpB,IAAA,KAAA,CAAMC,iCAAgB,EAAA,EAAE,IAAM,EAAA,kBAAA,EAAoB,CAAA;AAAA;AAEpD,CAAA;AAJoE,MAAA,CAAA,oBAAA,EAAA,qBAAA,CAAA;AAA7D,IAAM,mBAAN,GAAA","file":"PatternCommandStore.cjs","sourcesContent":["import { AliasStore } from '@sapphire/pieces';\nimport { PatternCommand } from './PatternCommand';\n\nexport class PatternCommandStore extends AliasStore<PatternCommand> {\n\tpublic constructor() {\n\t\tsuper(PatternCommand, { name: 'pattern-commands' });\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/structures/PatternCommandStore.ts"],"names":["AliasStore","PatternCommand"],"mappings":";;;;;;;AAGO,IAAM,oBAAA,GAAN,MAAM,oBAAA,SAA4BA,iBAAA,CAA2B;AAAA,EAC5D,WAAA,GAAc;AACpB,IAAA,KAAA,CAAMC,iCAAA,EAAgB,EAAE,IAAA,EAAM,kBAAA,EAAoB,CAAA;AAAA,EACnD;AACD,CAAA;AAJoE,MAAA,CAAA,oBAAA,EAAA,qBAAA,CAAA;AAA7D,IAAM,mBAAA,GAAN","file":"PatternCommandStore.cjs","sourcesContent":["import { AliasStore } from '@sapphire/pieces';\nimport { PatternCommand } from './PatternCommand';\n\nexport class PatternCommandStore extends AliasStore<PatternCommand> {\n\tpublic constructor() {\n\t\tsuper(PatternCommand, { name: 'pattern-commands' });\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/utils/PatternCommandEvents.ts"],"names":["PatternCommandEvents"],"mappings":";;;AAIY,IAAA,oBAAA,qBAAAA,qBAAL,KAAA;AAON,EAAAA,sBAAA,eAAgB,CAAA,GAAA,sBAAA;AAKhB,EAAAA,sBAAA,eAAgB,CAAA,GAAA,sBAAA;AAKhB,EAAAA,sBAAA,iBAAkB,CAAA,GAAA,wBAAA;AAMlB,EAAAA,sBAAA,eAAgB,CAAA,GAAA,sBAAA;AAOhB,EAAAA,sBAAA,YAAa,CAAA,GAAA,mBAAA;AAQb,EAAAA,sBAAA,gBAAiB,CAAA,GAAA,uBAAA;AAOjB,EAAAA,sBAAA,cAAe,CAAA,GAAA,qBAAA;AAOf,EAAAA,sBAAA,iBAAkB,CAAA,GAAA,wBAAA;AApDP,EAAAA,OAAAA,qBAAAA;AAAA,CAAA,EAAA,oBAAA,IAAA,EAAA","file":"PatternCommandEvents.cjs","sourcesContent":["/**\n * Events emitted during the parsing and command run.\n * You can use these events for debugging and logging purposes.\n */\nexport enum PatternCommandEvents {\n\t/**\n\t * Event that is emitted when the RNG doesn't love the command\n\t * @param message The message where the command was triggered\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t */\n\tCommandNoLuck = 'patternCommandNoLuck',\n\t/**\n\t * Event that is emitted when an alias triggered the command but before parsing the preconditions\n\t * @param payload PatternCommandRunPayload which contains message, command and alias\n\t */\n\tPreCommandRun = 'patternCommandPreRun',\n\t/**\n\t * Event that is emitted after the preconditions if none of them denied the command\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandAccepted = 'patternCommandAccepted',\n\t/**\n\t * Event that is emitted after the preconditions if at least one of them denied the command\n\t * @param error The error of the precondition which denied the command\n\t * @param payload PatternCommandDeniedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandDenied = 'patternCommandDenied',\n\t/**\n\t * Event that is emitted just before the command is ran\n\t * @param message The message where the command was triggered\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t */\n\tCommandRun = 'patternCommandRun',\n\t/**\n\t * Event that is emitted if there's no error while running the command\n\t * @param result The result of command's run\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t * @param duration The duration which indicates how long it took the command to run\n\t */\n\tCommandSuccess = 'patternCommandSuccess',\n\t/**\n\t * Event that is emitted if there's an error while running the command\n\t * @param error The error message which happened while the command was running\n\t * @param command The command's piece\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandError = 'patternCommandError',\n\t/**\n\t * Event that is emitted if the command has finished, regardless of whether an error occurred or not\n\t * @param command The command's piece\n\t * @param duration The duration which indicates how long it took the command to run\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandFinished = 'patternCommandFinished'\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/utils/PatternCommandEvents.ts"],"names":["PatternCommandEvents"],"mappings":";;;AAIO,IAAK,oBAAA,qBAAAA,qBAAAA,KAAL;AAON,EAAAA,sBAAA,eAAA,CAAA,GAAgB,sBAAA;AAKhB,EAAAA,sBAAA,eAAA,CAAA,GAAgB,sBAAA;AAKhB,EAAAA,sBAAA,iBAAA,CAAA,GAAkB,wBAAA;AAMlB,EAAAA,sBAAA,eAAA,CAAA,GAAgB,sBAAA;AAOhB,EAAAA,sBAAA,YAAA,CAAA,GAAa,mBAAA;AAQb,EAAAA,sBAAA,gBAAA,CAAA,GAAiB,uBAAA;AAOjB,EAAAA,sBAAA,cAAA,CAAA,GAAe,qBAAA;AAOf,EAAAA,sBAAA,iBAAA,CAAA,GAAkB,wBAAA;AApDP,EAAA,OAAAA,qBAAAA;AAAA,CAAA,EAAA,oBAAA,IAAA,EAAA","file":"PatternCommandEvents.cjs","sourcesContent":["/**\n * Events emitted during the parsing and command run.\n * You can use these events for debugging and logging purposes.\n */\nexport enum PatternCommandEvents {\n\t/**\n\t * Event that is emitted when the RNG doesn't love the command\n\t * @param message The message where the command was triggered\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t */\n\tCommandNoLuck = 'patternCommandNoLuck',\n\t/**\n\t * Event that is emitted when an alias triggered the command but before parsing the preconditions\n\t * @param payload PatternCommandRunPayload which contains message, command and alias\n\t */\n\tPreCommandRun = 'patternCommandPreRun',\n\t/**\n\t * Event that is emitted after the preconditions if none of them denied the command\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandAccepted = 'patternCommandAccepted',\n\t/**\n\t * Event that is emitted after the preconditions if at least one of them denied the command\n\t * @param error The error of the precondition which denied the command\n\t * @param payload PatternCommandDeniedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandDenied = 'patternCommandDenied',\n\t/**\n\t * Event that is emitted just before the command is ran\n\t * @param message The message where the command was triggered\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t */\n\tCommandRun = 'patternCommandRun',\n\t/**\n\t * Event that is emitted if there's no error while running the command\n\t * @param result The result of command's run\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t * @param duration The duration which indicates how long it took the command to run\n\t */\n\tCommandSuccess = 'patternCommandSuccess',\n\t/**\n\t * Event that is emitted if there's an error while running the command\n\t * @param error The error message which happened while the command was running\n\t * @param command The command's piece\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandError = 'patternCommandError',\n\t/**\n\t * Event that is emitted if the command has finished, regardless of whether an error occurred or not\n\t * @param command The command's piece\n\t * @param duration The duration which indicates how long it took the command to run\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandFinished = 'patternCommandFinished'\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/listeners/PluginCommandAccepted.ts"],"names":["Listener","PatternCommandEvents","Result","stopwatch","Stopwatch","result"],"mappings":";;;;;;;;AAKO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAAsD,CAAA;AAAA,EAClF,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAAC,6CAAA,CAAqB,iBAAiB,CAAA;AAAA;AAC/D,EAEA,MAAsB,IAAI,OAAwC,EAAA;AACjE,IAAM,MAAA,EAAE,OAAS,EAAA,OAAA,EAAY,GAAA,OAAA;AAE7B,IAAA,MAAM,MAAS,GAAA,MAAMC,gBAAO,CAAA,SAAA,CAAU,YAAY;AACjD,MAAA,OAAA,CAAQ,OAAO,IAAK,CAAAD,6CAAA,CAAqB,UAAY,EAAA,OAAA,EAAS,SAAS,OAAO,CAAA;AAE9E,MAAM,MAAAE,WAAA,GAAY,IAAIC,mBAAU,EAAA;AAChC,MAAA,MAAMC,OAAS,GAAA,MAAM,OAAQ,CAAA,UAAA,CAAW,OAAO,CAAA;AAC/C,MAAA,MAAM,EAAE,QAAA,EAAa,GAAAF,WAAA,CAAU,IAAK,EAAA;AAEpC,MAAQ,OAAA,CAAA,MAAA,CAAO,IAAK,CAAAF,6CAAA,CAAqB,cAAgB,EAAA,EAAE,GAAG,OAAS,EAAA,MAAA,EAAAI,OAAQ,EAAA,QAAA,EAAU,CAAA;AAEzF,MAAO,OAAA,QAAA;AAAA,KACP,CAAA;AAED,IAAA,MAAA,CAAO,UAAW,CAAA,CAAC,KAAU,KAAA,OAAA,CAAQ,OAAO,IAAK,CAAAJ,6CAAA,CAAqB,YAAc,EAAA,KAAA,EAAO,EAAE,GAAG,OAAA,EAAS,QAAU,EAAA,EAAA,EAAI,CAAC,CAAA;AAExH,IAAA,OAAA,CAAQ,MAAO,CAAA,IAAA,CAAKA,6CAAqB,CAAA,eAAA,EAAiB,SAAS,OAAS,EAAA;AAAA,MAC3E,GAAG,OAAA;AAAA,MACH,OAAA,EAAS,OAAO,IAAK,EAAA;AAAA,MACrB,QAAA,EAAU,MAAO,CAAA,QAAA,CAAS,EAAE;AAAA,KAC5B,CAAA;AAAA;AAEH,CAAA;AA5B0F,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAnF,IAAM,cAAN,GAAA","file":"PluginCommandAccepted.cjs","sourcesContent":["import { Listener, Result } from '@sapphire/framework';\nimport { Stopwatch } from '@sapphire/stopwatch';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PatternCommandAcceptedPayload } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof PatternCommandEvents.CommandAccepted> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: PatternCommandEvents.CommandAccepted });\n\t}\n\n\tpublic override async run(payload: PatternCommandAcceptedPayload) {\n\t\tconst { message, command } = payload;\n\n\t\tconst result = await Result.fromAsync(async () => {\n\t\t\tmessage.client.emit(PatternCommandEvents.CommandRun, message, command, payload);\n\n\t\t\tconst stopwatch = new Stopwatch();\n\t\t\tconst result = await command.messageRun(message);\n\t\t\tconst { duration } = stopwatch.stop();\n\n\t\t\tmessage.client.emit(PatternCommandEvents.CommandSuccess, { ...payload, result, duration });\n\n\t\t\treturn duration;\n\t\t});\n\n\t\tresult.inspectErr((error) => message.client.emit(PatternCommandEvents.CommandError, error, { ...payload, duration: -1 }));\n\n\t\tmessage.client.emit(PatternCommandEvents.CommandFinished, message, command, {\n\t\t\t...payload,\n\t\t\tsuccess: result.isOk(),\n\t\t\tduration: result.unwrap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A,CAAqB,eAAA,EAAiB,SAAS,OAAA,EAAS;AAAA,MAC3E,GAAG,OAAA;AAAA,MACH,OAAA,EAAS,OAAO,IAAA,EAAK;AAAA,MACrB,QAAA,EAAU,MAAA,CAAO,QAAA,CAAS,EAAE;AAAA,KAC5B,CAAA;AAAA,EACF;AACD,CAAA;AA5B0F,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAnF,IAAM,cAAA,GAAN","file":"PluginCommandAccepted.cjs","sourcesContent":["import { Listener, Result } from '@sapphire/framework';\nimport { Stopwatch } from '@sapphire/stopwatch';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PatternCommandAcceptedPayload } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof PatternCommandEvents.CommandAccepted> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: PatternCommandEvents.CommandAccepted });\n\t}\n\n\tpublic override async run(payload: PatternCommandAcceptedPayload) {\n\t\tconst { message, command } = payload;\n\n\t\tconst result = await Result.fromAsync(async () => {\n\t\t\tmessage.client.emit(PatternCommandEvents.CommandRun, message, command, payload);\n\n\t\t\tconst stopwatch = new Stopwatch();\n\t\t\tconst result = await command.messageRun(message);\n\t\t\tconst { duration } = stopwatch.stop();\n\n\t\t\tmessage.client.emit(PatternCommandEvents.CommandSuccess, { ...payload, result, duration });\n\n\t\t\treturn duration;\n\t\t});\n\n\t\tresult.inspectErr((error) => message.client.emit(PatternCommandEvents.CommandError, error, { ...payload, duration: -1 }));\n\n\t\tmessage.client.emit(PatternCommandEvents.CommandFinished, message, command, {\n\t\t\t...payload,\n\t\t\tsuccess: result.isOk(),\n\t\t\tduration: result.unwrapOr(-1)\n\t\t});\n\t}\n}\n"]}
@@ -45,7 +45,7 @@ var _PluginListener = class _PluginListener extends framework.Listener {
45
45
  });
46
46
  continue;
47
47
  }
48
- if (content.match(new RegExp(patternCommand.matchFullName ? `\b${key}\b` : key, client.options.caseInsensitiveCommands ? "i" : undefined))) {
48
+ if (content.match(new RegExp(patternCommand.matchFullName ? `\b${key}\b` : key, client.options.caseInsensitiveCommands ? "i" : void 0))) {
49
49
  possiblePatternCommands.push({
50
50
  command: patternCommand,
51
51
  alias: content,
@@ -54,7 +54,7 @@ var _PluginListener = class _PluginListener extends framework.Listener {
54
54
  continue;
55
55
  }
56
56
  const aliasRegexMatch = patternCommand.aliases.find(
57
- (alias) => content.match(new RegExp(alias, client.options.caseInsensitiveCommands ? "i" : undefined))
57
+ (alias) => content.match(new RegExp(alias, client.options.caseInsensitiveCommands ? "i" : void 0))
58
58
  );
59
59
  if (aliasRegexMatch) {
60
60
  possiblePatternCommands.push({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/listeners/PluginMessageParse.ts"],"names":["Listener","Events","PermissionsBitField","PermissionFlagsBits","PatternCommandEvents","isDMChannel"],"mappings":";;;;;;;;;;;AAOO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAAyC,CAAA;AAAA,EAErE,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAAC,gBAAA,CAAO,kBAAkB,CAAA;AAFlD,IAAiB,aAAA,CAAA,IAAA,EAAA,qBAAA,EAAsB,IAAIC,8BAAA,CAAoB,CAACC,8BAAA,CAAoB,aAAaA,8BAAoB,CAAA,YAAY,CAAC,CAAA,CAAE,MAAO,EAAA,CAAA;AAAA;AAG3I,EAEA,MAAsB,IAAI,OAAkB,EAAA;AAC3C,IAAA,MAAM,MAAS,GAAA,MAAM,IAAK,CAAA,eAAA,CAAgB,OAAO,CAAA;AACjD,IAAA,IAAI,CAAC,MAAQ,EAAA;AAEb,IAAI,IAAA,EAAE,SAAY,GAAA,OAAA;AAClB,IAAA,MAAM,EAAE,MAAA,EAAQ,MAAO,EAAA,GAAI,IAAK,CAAA,SAAA;AAEhC,IAAM,MAAA,mBAAA,GAAsB,MAAO,CAAA,GAAA,CAAI,kBAAkB,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,CAAM,IAAI,MAAA,CAAO,KAAO,EAAA,MAAA,CAAO,OAAQ,CAAA,uBAAA,GAA0B,GAAM,GAAA,SAAS,CAAC;AAAA,OAC1F;AAEA,MAAA,IAAI,eAAiB,EAAA;AACpB,QAAA,uBAAA,CAAwB,IAAK,CAAA;AAAA,UAC5B,OAAS,EAAA,cAAA;AAAA,UACT,KAAO,EAAA,eAAA;AAAA,UACP,QAAQ,cAAe,CAAA;AAAA,SACvB,CAAA;AACD,QAAA;AAAA;AACD;AAGD,IAAI,IAAA,uBAAA,CAAwB,SAAS,CAAG,EAAA;AACvC,MAAA,MAAM,6BAAgC,GAAA,uBAAA,CAAwB,IAAK,CAAA,CAAC,OAAO,MAAW,KAAA;AACrF,QAAO,OAAA,MAAA,CAAO,SAAS,KAAM,CAAA,MAAA;AAAA,OAC7B,CAAA;AAED,MAAA,MAAA,CAAO,KAAKC,6CAAqB,CAAA,aAAA,EAAe,EAAE,OAAS,EAAA,gBAAA,EAAkB,+BAA+B,CAAA;AAAA;AAC7G;AACD,EAEA,MAAc,gBAAgB,OAAoC,EAAA;AACjE,IAAA,IAAIC,+BAAY,CAAA,OAAA,CAAQ,OAAO,CAAA,EAAU,OAAA,IAAA;AAEzC,IAAA,MAAM,EAAK,GAAA,MAAM,OAAQ,CAAA,KAAA,EAAO,QAAQ,OAAQ,EAAA;AAChD,IAAI,IAAA,CAAC,IAAW,OAAA,KAAA;AAEhB,IAAA,MAAM,UAAU,OAAQ,CAAA,OAAA;AACxB,IAAA,OAAO,QAAQ,cAAe,CAAA,EAAE,EAAE,GAAI,CAAA,IAAA,CAAK,qBAAqB,KAAK,CAAA;AAAA;AAEvE,CAAA;AAzF6E,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAtE,IAAM,cAAN,GAAA","file":"PluginMessageParse.cjs","sourcesContent":["import { isDMChannel, type GuildBasedChannelTypes } from '@sapphire/discord.js-utilities';\nimport { Events, Listener } from '@sapphire/framework';\nimport { Message, PermissionFlagsBits, PermissionsBitField } from 'discord.js';\nimport type { PatternCommandStore } from '../lib/structures/PatternCommandStore';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PossiblePatternCommand } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof Events.PreMessageParsed> {\n\tprivate readonly requiredPermissions = new PermissionsBitField([PermissionFlagsBits.ViewChannel, PermissionFlagsBits.SendMessages]).freeze();\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: Events.PreMessageParsed });\n\t}\n\n\tpublic override async run(message: Message) {\n\t\tconst canRun = await this.canRunInChannel(message);\n\t\tif (!canRun) return;\n\n\t\tlet { content } = message;\n\t\tconst { client, stores } = this.container;\n\n\t\tconst patternCommandStore = stores.get('pattern-commands') as PatternCommandStore | undefined;\n\n\t\tif (!patternCommandStore) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (client.options.caseInsensitiveCommands) {\n\t\t\tcontent = content.toLowerCase();\n\t\t}\n\n\t\tconst possiblePatternCommands: PossiblePatternCommand[] = [];\n\n\t\tfor (const [key, patternCommand] of patternCommandStore) {\n\t\t\tif (content === key) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: key,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst aliasMatch = patternCommand.aliases.find((alias) => alias === content);\n\n\t\t\tif (aliasMatch) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: aliasMatch,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontent.match(new RegExp(patternCommand.matchFullName ? `\\b${key}\\b` : key, client.options.caseInsensitiveCommands ? 'i' : undefined))\n\t\t\t) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: content,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst aliasRegexMatch = patternCommand.aliases.find((alias) =>\n\t\t\t\tcontent.match(new RegExp(alias, client.options.caseInsensitiveCommands ? 'i' : undefined))\n\t\t\t);\n\n\t\t\tif (aliasRegexMatch) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: aliasRegexMatch,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (possiblePatternCommands.length > 0) {\n\t\t\tconst sortedPossiblePatternCommands = possiblePatternCommands.sort((first, second) => {\n\t\t\t\treturn second.weight - first.weight;\n\t\t\t});\n\n\t\t\tclient.emit(PatternCommandEvents.PreCommandRun, { message, possibleCommands: sortedPossiblePatternCommands });\n\t\t}\n\t}\n\n\tprivate async canRunInChannel(message: Message): Promise<boolean> {\n\t\tif (isDMChannel(message.channel)) return true;\n\n\t\tconst me = await message.guild?.members.fetchMe();\n\t\tif (!me) return false;\n\n\t\tconst channel = message.channel as GuildBasedChannelTypes;\n\t\treturn channel.permissionsFor(me).has(this.requiredPermissions, false);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/listeners/PluginMessageParse.ts"],"names":["Listener","Events","PermissionsBitField","PermissionFlagsBits","PatternCommandEvents","isDMChannel"],"mappings":";;;;;;;;;;;AAOO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAAA,CAAyC;AAAA,EAErE,YAAY,OAAA,EAAiC;AACnD,IAAA,KAAA,CAAM,OAAA,EAAS,EAAE,KAAA,EAAOC,gBAAA,CAAO,kBAAkB,CAAA;AAFlD,IAAA,aAAA,CAAA,IAAA,EAAiB,qBAAA,EAAsB,IAAIC,8BAAA,CAAoB,CAACC,8BAAA,CAAoB,aAAaA,8B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GAAK,MAAM,OAAA,CAAQ,KAAA,EAAO,QAAQ,OAAA,EAAQ;AAChD,IAAA,IAAI,CAAC,IAAI,OAAO,KAAA;AAEhB,IAAA,MAAM,UAAU,OAAA,CAAQ,OAAA;AACxB,IAAA,OAAO,QAAQ,cAAA,CAAe,EAAE,EAAE,GAAA,CAAI,IAAA,CAAK,qBAAqB,KAAK,CAAA;AAAA,EACtE;AACD,CAAA;AAzF6E,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAtE,IAAM,cAAA,GAAN","file":"PluginMessageParse.cjs","sourcesContent":["import { isDMChannel, type GuildBasedChannelTypes } from '@sapphire/discord.js-utilities';\nimport { Events, Listener } from '@sapphire/framework';\nimport { Message, PermissionFlagsBits, PermissionsBitField } from 'discord.js';\nimport type { PatternCommandStore } from '../lib/structures/PatternCommandStore';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PossiblePatternCommand } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof Events.PreMessageParsed> {\n\tprivate readonly requiredPermissions = new PermissionsBitField([PermissionFlagsBits.ViewChannel, PermissionFlagsBits.SendMessages]).freeze();\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: Events.PreMessageParsed });\n\t}\n\n\tpublic override async run(message: Message) {\n\t\tconst canRun = await this.canRunInChannel(message);\n\t\tif (!canRun) return;\n\n\t\tlet { content } = message;\n\t\tconst { client, stores } = this.container;\n\n\t\tconst patternCommandStore = stores.get('pattern-commands') as PatternCommandStore | undefined;\n\n\t\tif (!patternCommandStore) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (client.options.caseInsensitiveCommands) {\n\t\t\tcontent = content.toLowerCase();\n\t\t}\n\n\t\tconst possiblePatternCommands: PossiblePatternCommand[] = [];\n\n\t\tfor (const [key, patternCommand] of patternCommandStore) {\n\t\t\tif (content === key) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: key,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst aliasMatch = patternCommand.aliases.find((alias) => alias === content);\n\n\t\t\tif (aliasMatch) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: aliasMatch,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontent.match(new RegExp(patternCommand.matchFullName ? `\\b${key}\\b` : key, client.options.caseInsensitiveCommands ? 'i' : undefined))\n\t\t\t) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: content,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst aliasRegexMatch = patternCommand.aliases.find((alias) =>\n\t\t\t\tcontent.match(new RegExp(alias, client.options.caseInsensitiveCommands ? 'i' : undefined))\n\t\t\t);\n\n\t\t\tif (aliasRegexMatch) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: aliasRegexMatch,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (possiblePatternCommands.length > 0) {\n\t\t\tconst sortedPossiblePatternCommands = possiblePatternCommands.sort((first, second) => {\n\t\t\t\treturn second.weight - first.weight;\n\t\t\t});\n\n\t\t\tclient.emit(PatternCommandEvents.PreCommandRun, { message, possibleCommands: sortedPossiblePatternCommands });\n\t\t}\n\t}\n\n\tprivate async canRunInChannel(message: Message): Promise<boolean> {\n\t\tif (isDMChannel(message.channel)) return true;\n\n\t\tconst me = await message.guild?.members.fetchMe();\n\t\tif (!me) return false;\n\n\t\tconst channel = message.channel as GuildBasedChannelTypes;\n\t\treturn channel.permissionsFor(me).has(this.requiredPermissions, false);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/listeners/PluginPreCommandRun.ts"],"names":["Listener","PatternCommandEvents"],"mappings":";;;;;;;AAIO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAAoD,CAAA;AAAA,EAChF,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAAC,6CAAA,CAAqB,eAAe,CAAA;AAAA;AAC7D,EAEA,MAAsB,IAAI,OAAmC,EAAA;AAC5D,IAAM,MAAA,EAAE,OAAS,EAAA,gBAAA,EAAqB,GAAA,OAAA;AAEtC,IAAA,KAAA,MAAW,mBAAmB,gBAAkB,EAAA;AAC/C,MAAM,MAAA,EAAE,SAAY,GAAA,eAAA;AACpB,MAAA,MAAM,cAAwC,GAAA;AAAA,QAC7C,OAAA;AAAA,QACA,OAAA;AAAA,QACA,OAAO,eAAgB,CAAA;AAAA,OACxB;AAGA,MAAA,MAAM,eAAe,MAAO,IAAA,CAAK,UAAU,MAAO,CAAA,GAAA,CAAI,eAAe,CAAmC,CAAA,UAAA;AAAA,QACvG,OAAA;AAAA,QACA,OAAA;AAAA,QACA;AAAA,OACD;AAEA,MAAI,IAAA,YAAA,CAAa,OAAS,EAAA;AACzB,QAAA,OAAA,CAAQ,OAAO,IAAK,CAAAA,6CAAA,CAAqB,eAAe,YAAa,CAAA,SAAA,IAAa,cAAc,CAAA;AAChG,QAAA;AAAA;AAID,MAAA,MAAM,cAAc,MAAM,OAAA,CAAQ,cAAc,UAAW,CAAA,OAAA,EAAS,SAAS,OAAc,CAAA;AAC3F,MAAI,IAAA,WAAA,CAAY,OAAS,EAAA;AACxB,QAAA,OAAA,CAAQ,OAAO,IAAK,CAAAA,6CAAA,CAAqB,eAAe,WAAY,CAAA,SAAA,IAAa,cAAc,CAAA;AAC/F,QAAA;AAAA;AAGD,MAAI,IAAA,OAAA,CAAQ,UAAU,IAAK,CAAA,KAAA,CAAM,KAAK,MAAO,EAAA,GAAI,EAAE,CAAA,GAAI,CAAG,EAAA;AACzD,QAAA,OAAA,CAAQ,MAAO,CAAA,IAAA,CAAKA,6CAAqB,CAAA,eAAA,EAAiB,cAAc,CAAA;AACxE,QAAA;AAAA,OACM,MAAA;AACN,QAAA,OAAA,CAAQ,MAAO,CAAA,IAAA,CAAKA,6CAAqB,CAAA,aAAA,EAAe,cAAc,CAAA;AAAA;AACvE;AACD;AAEF,CAAA;AA3CwF,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAjF,IAAM,cAAN,GAAA","file":"PluginPreCommandRun.cjs","sourcesContent":["import { Listener, type PreconditionStore } from '@sapphire/framework';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PatternCommandPayload, PatternCommandPrePayload } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof PatternCommandEvents.PreCommandRun> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: PatternCommandEvents.PreCommandRun });\n\t}\n\n\tpublic override async run(payload: PatternCommandPrePayload) {\n\t\tconst { message, possibleCommands } = payload;\n\n\t\tfor (const possibleCommand of possibleCommands) {\n\t\t\tconst { command } = possibleCommand;\n\t\t\tconst commandPayload: PatternCommandPayload = {\n\t\t\t\tmessage,\n\t\t\t\tcommand,\n\t\t\t\talias: possibleCommand.alias\n\t\t\t};\n\n\t\t\t// Run global preconditions:\n\t\t\tconst globalResult = await (this.container.stores.get('preconditions') as unknown as PreconditionStore).messageRun(\n\t\t\t\tmessage,\n\t\t\t\tcommand,\n\t\t\t\tcommandPayload as any\n\t\t\t);\n\n\t\t\tif (globalResult.isErr()) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandDenied, globalResult.unwrapErr(), commandPayload);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Run command-specific preconditions:\n\t\t\tconst localResult = await command.preconditions.messageRun(message, command, payload as any);\n\t\t\tif (localResult.isErr()) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandDenied, localResult.unwrapErr(), commandPayload);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (command.chance >= Math.round(Math.random() * 99) + 1) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandAccepted, commandPayload);\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandNoLuck, commandPayload);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/listeners/PluginPreCommandRun.ts"],"names":["Listener","PatternCommandEvents"],"mappings":";;;;;;;AAIO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuBA,kBAAA,CAAoD;AAAA,EAChF,YAAY,OAAA,EAAiC;AACnD,IAAA,KAAA,CAAM,OAAA,EAAS,EAAE,KAAA,EAAOC,6CAAA,CAAqB,eAAe,CAAA;AAAA,EAC7D;AAAA,EAEA,MAAsB,IAAI,OAAA,EAAmC;AAC5D,IAAA,MAAM,EAAE,OAAA,EAAS,gBAAA,EAAiB,GAAI,OAAA;AAEtC,IAAA,KAAA,MAAW,mBAAmB,gBAAA,EAAkB;AAC/C,MAAA,MAAM,EAAE,SAAQ,GAAI,eAAA;AACpB,MAAA,MAAM,cAAA,GAAwC;AAAA,QAC7C,OAAA;AAAA,QACA,OAAA;AAAA,QACA,OAAO,eAAA,CAAgB;AAAA,OACxB;AAGA,MAAA,MAAM,eAAe,MAAO,IAAA,CAAK,UAAU,MAAA,CAAO,GAAA,CAAI,eAAe,CAAA,CAAmC,UAAA;AAAA,QACvG,OAAA;AAAA,QACA,OAAA;AAAA,QACA;AAAA,OACD;AAEA,MAAA,IAAI,YAAA,CAAa,OAAM,EAAG;AACzB,QAAA,OAAA,CAAQ,OAAO,IAAA,CAAKA,6CAAA,CAAqB,eAAe,YAAA,CAAa,SAAA,IAAa,cAAc,CAAA;AAChG,QAAA;AAAA,MACD;AAGA,MAAA,MAAM,cAAc,MAAM,OAAA,CAAQ,cAAc,UAAA,CAAW,OAAA,EAAS,SAAS,OAAc,CAAA;AAC3F,MAAA,IAAI,WAAA,CAAY,OAAM,EAAG;AACxB,QAAA,OAAA,CAAQ,OAAO,IAAA,CAAKA,6CAAA,CAAqB,eAAe,WAAA,CAAY,SAAA,IAAa,cAAc,CAAA;AAC/F,QAAA;AAAA,MACD;AAEA,MAAA,IAAI,OAAA,CAAQ,UAAU,IAAA,CAAK,KAAA,CAAM,KAAK,MAAA,EAAO,GAAI,EAAE,CAAA,GAAI,CAAA,EAAG;AACzD,QAAA,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAKA,6CAAA,CAAqB,eAAA,EAAiB,cAAc,CAAA;AACxE,QAAA;AAAA,MACD,CAAA,MAAO;AACN,QAAA,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAKA,6CAAA,CAAqB,aAAA,EAAe,cAAc,CAAA;AAAA,MACvE;AAAA,IACD;AAAA,EACD;AACD,CAAA;AA3CwF,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAjF,IAAM,cAAA,GAAN","file":"PluginPreCommandRun.cjs","sourcesContent":["import { Listener, type PreconditionStore } from '@sapphire/framework';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PatternCommandPayload, PatternCommandPrePayload } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof PatternCommandEvents.PreCommandRun> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: PatternCommandEvents.PreCommandRun });\n\t}\n\n\tpublic override async run(payload: PatternCommandPrePayload) {\n\t\tconst { message, possibleCommands } = payload;\n\n\t\tfor (const possibleCommand of possibleCommands) {\n\t\t\tconst { command } = possibleCommand;\n\t\t\tconst commandPayload: PatternCommandPayload = {\n\t\t\t\tmessage,\n\t\t\t\tcommand,\n\t\t\t\talias: possibleCommand.alias\n\t\t\t};\n\n\t\t\t// Run global preconditions:\n\t\t\tconst globalResult = await (this.container.stores.get('preconditions') as unknown as PreconditionStore).messageRun(\n\t\t\t\tmessage,\n\t\t\t\tcommand,\n\t\t\t\tcommandPayload as any\n\t\t\t);\n\n\t\t\tif (globalResult.isErr()) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandDenied, globalResult.unwrapErr(), commandPayload);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Run command-specific preconditions:\n\t\t\tconst localResult = await command.preconditions.messageRun(message, command, payload as any);\n\t\t\tif (localResult.isErr()) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandDenied, localResult.unwrapErr(), commandPayload);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (command.chance >= Math.round(Math.random() * 99) + 1) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandAccepted, commandPayload);\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandNoLuck, commandPayload);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/listeners/_load.ts"],"names":["container","PluginCommandAccepted","PluginMessageParse","PluginPreCommandRun"],"mappings":";;;;;;;;;AAKO,SAAS,aAAgB,GAAA;AAC/B,EAAA,MAAM,KAAQ,GAAA,WAAA;AACd,EAAK,KAAAA,gBAAA,CAAU,OAAO,SAAU,CAAA,EAAE,MAAM,uBAAyB,EAAA,KAAA,EAAOC,wCAAuB,EAAA,KAAA,EAAO,CAAA;AACtG,EAAK,KAAAD,gBAAA,CAAU,OAAO,SAAU,CAAA,EAAE,MAAM,oBAAsB,EAAA,KAAA,EAAOE,qCAAoB,EAAA,KAAA,EAAO,CAAA;AAChG,EAAK,KAAAF,gBAAA,CAAU,OAAO,SAAU,CAAA,EAAE,MAAM,qBAAuB,EAAA,KAAA,EAAOG,sCAAqB,EAAA,KAAA,EAAO,CAAA;AACnG;AALgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"_load.cjs","sourcesContent":["import { container } from '@sapphire/pieces';\nimport { PluginListener as PluginCommandAccepted } from './PluginCommandAccepted';\nimport { PluginListener as PluginMessageParse } from './PluginMessageParse';\nimport { PluginListener as PluginPreCommandRun } from './PluginPreCommandRun';\n\nexport function loadListeners() {\n\tconst store = 'listeners' as const;\n\tvoid container.stores.loadPiece({ name: 'PluginCommandAccepted', piece: PluginCommandAccepted, store });\n\tvoid container.stores.loadPiece({ name: 'PluginMessageParse', piece: PluginMessageParse, store });\n\tvoid container.stores.loadPiece({ name: 'PluginPreCommandRun', piece: PluginPreCommandRun, store });\n}\n"]}
1
+ {"version":3,"sources":["../../../src/listeners/_load.ts"],"names":["container","PluginCommandAccepted","PluginMessageParse","PluginPreCommandRun"],"mappings":";;;;;;;;;AAKO,SAAS,aAAA,GAAgB;AAC/B,EAAA,MAAM,KAAA,GAAQ,WAAA;AACd,EAAA,KAAKA,gBAAA,CAAU,OAAO,SAAA,CAAU,EAAE,MAAM,uBAAA,EAAyB,KAAA,EAAOC,wCAAA,EAAuB,KAAA,EAAO,CAAA;AACtG,EAAA,KAAKD,gBAAA,CAAU,OAAO,SAAA,CAAU,EAAE,MAAM,oBAAA,EAAsB,KAAA,EAAOE,qCAAA,EAAoB,KAAA,EAAO,CAAA;AAChG,EAAA,KAAKF,gBAAA,CAAU,OAAO,SAAA,CAAU,EAAE,MAAM,qBAAA,EAAuB,KAAA,EAAOG,sCAAA,EAAqB,KAAA,EAAO,CAAA;AACnG;AALgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"_load.cjs","sourcesContent":["import { container } from '@sapphire/pieces';\nimport { PluginListener as PluginCommandAccepted } from './PluginCommandAccepted';\nimport { PluginListener as PluginMessageParse } from './PluginMessageParse';\nimport { PluginListener as PluginPreCommandRun } from './PluginPreCommandRun';\n\nexport function loadListeners() {\n\tconst store = 'listeners' as const;\n\tvoid container.stores.loadPiece({ name: 'PluginCommandAccepted', piece: PluginCommandAccepted, store });\n\tvoid container.stores.loadPiece({ name: 'PluginMessageParse', piece: PluginMessageParse, store });\n\tvoid container.stores.loadPiece({ name: 'PluginPreCommandRun', piece: PluginPreCommandRun, store });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/register.ts"],"names":["Plugin","postInitialization","PatternCommandStore","loadListeners","SapphireClient"],"mappings":";;;;;;;AASO,IAAM,qBAAA,GAAN,MAAM,qBAAA,SAA6BA,gBAAO,CAAA;AAAA;AAAA;AAAA;AAAA,EAIhD,QAAeC,4BAAkB,CAAA,CAAwB,QAA+B,EAAA;AACvF,IAAA,IAAA,CAAK,MAAO,CAAA,QAAA,CAAS,IAAIC,6BAAA,EAAqB,CAAA;AAC9C,IAAcC,uBAAA,EAAA;AAAA;AAEhB,CAAA;AARiD,MAAA,CAAA,qBAAA,EAAA,sBAAA,CAAA;AAA1C,IAAM,oBAAN,GAAA;AAUPC,wBAAA,CAAe,OAAQ,CAAA,8BAAA,CAA+B,oBAAqB,CAAAH,4BAAkB,GAAG,oCAAoC,CAAA","file":"register.cjs","sourcesContent":["import './index';\n\nimport { Plugin, postInitialization, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { loadListeners, PatternCommandStore } from './index';\n\n/**\n * @since 1.0.0\n */\nexport class PatternCommandPlugin extends Plugin {\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postInitialization](this: SapphireClient, _options: ClientOptions): void {\n\t\tthis.stores.register(new PatternCommandStore());\n\t\tloadListeners();\n\t}\n}\n\nSapphireClient.plugins.registerPostInitializationHook(PatternCommandPlugin[postInitialization], 'Pattern-Command-PostInitialization');\n"]}
1
+ {"version":3,"sources":["../../src/register.ts"],"names":["Plugin","postInitialization","PatternCommandStore","loadListeners","SapphireClient"],"mappings":";;;;;;;AASO,IAAM,qBAAA,GAAN,MAAM,qBAAA,SAA6BA,gBAAA,CAAO;AAAA;AAAA;AAAA;AAAA,EAIhD,QAAwBC,4BAAkB,CAAA,CAAwB,QAAA,EAA+B;AAChG,IAAA,IAAA,CAAK,MAAA,CAAO,QAAA,CAAS,IAAIC,6BAAA,EAAqB,CAAA;AAC9C,IAAAC,uBAAA,EAAc;AAAA,EACf;AACD,CAAA;AARiD,MAAA,CAAA,qBAAA,EAAA,sBAAA,CAAA;AAA1C,IAAM,oBAAA,GAAN;AAUPC,wBAAA,CAAe,OAAA,CAAQ,8BAAA,CAA+B,oBAAA,CAAqBH,4BAAkB,GAAG,oCAAoC,CAAA","file":"register.cjs","sourcesContent":["import './index';\n\nimport { Plugin, postInitialization, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { loadListeners, PatternCommandStore } from './index';\n\n/**\n * @since 1.0.0\n */\nexport class PatternCommandPlugin extends Plugin {\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static override [postInitialization](this: SapphireClient, _options: ClientOptions): void {\n\t\tthis.stores.register(new PatternCommandStore());\n\t\tloadListeners();\n\t}\n}\n\nSapphireClient.plugins.registerPostInitializationHook(PatternCommandPlugin[postInitialization], 'Pattern-Command-PostInitialization');\n"]}
@@ -1,5 +1,5 @@
1
1
  import { AliasStore } from '@sapphire/pieces';
2
- import { MessageCommand, Command, Args, Listener, Events } from '@sapphire/framework';
2
+ import { Command, Args, MessageCommand, Listener, Events } from '@sapphire/framework';
3
3
  import { Message, Awaitable } from 'discord.js';
4
4
 
5
5
  interface PatternCommandOptions extends MessageCommand.Options {
@@ -8,7 +8,7 @@ export { PluginListener as PluginPatternCommandsMessageParseListener } from './l
8
8
  export { PluginListener as PluginPatternCommandsPreCommandRunListener } from './listeners/PluginPreCommandRun.mjs';
9
9
  export { loadListeners } from './listeners/_load.mjs';
10
10
 
11
- var version = "6.0.4-next.ebf804c";
11
+ var version = "6.0.4-next.edf5e96";
12
12
 
13
13
  export { version };
14
14
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAyBO,IAAM,OAAkB,GAAA","file":"index.mjs","sourcesContent":["import type { PatternCommandStore } from './lib/structures/PatternCommandStore';\n\nexport * from './lib/structures/PatternCommandStore';\nexport * from './lib/structures/PatternCommand';\nexport * from './lib/utils/PatternCommandEvents';\nexport * from './lib/utils/PatternCommandInterfaces';\nexport { PluginListener as PluginPatternCommandsCommandAcceptedListener } from './listeners/PluginCommandAccepted';\nexport { PluginListener as PluginPatternCommandsMessageParseListener } from './listeners/PluginMessageParse';\nexport { PluginListener as PluginPatternCommandsPreCommandRunListener } from './listeners/PluginPreCommandRun';\n\nexport { loadListeners } from './listeners/_load';\n\ndeclare module '@sapphire/pieces' {\n\tinterface StoreRegistryEntries {\n\t\t'pattern-commands': PatternCommandStore;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-pattern-commands](https://github.com/sapphiredev/plugins/blob/main/packages/pattern-commands) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '6.0.4-next.ebf804c';\n"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAyBO,IAAM,OAAA,GAAkB","file":"index.mjs","sourcesContent":["import type { PatternCommandStore } from './lib/structures/PatternCommandStore';\n\nexport * from './lib/structures/PatternCommandStore';\nexport * from './lib/structures/PatternCommand';\nexport * from './lib/utils/PatternCommandEvents';\nexport * from './lib/utils/PatternCommandInterfaces';\nexport { PluginListener as PluginPatternCommandsCommandAcceptedListener } from './listeners/PluginCommandAccepted';\nexport { PluginListener as PluginPatternCommandsMessageParseListener } from './listeners/PluginMessageParse';\nexport { PluginListener as PluginPatternCommandsPreCommandRunListener } from './listeners/PluginPreCommandRun';\n\nexport { loadListeners } from './listeners/_load';\n\ndeclare module '@sapphire/pieces' {\n\tinterface StoreRegistryEntries {\n\t\t'pattern-commands': PatternCommandStore;\n\t}\n}\n\n/**\n * The [@sapphire/plugin-pattern-commands](https://github.com/sapphiredev/plugins/blob/main/packages/pattern-commands) version that you are currently using.\n * An example use of this is showing it of in a bot information command.\n *\n * Note to Sapphire developers: This needs to explicitly be `string` so it is not typed as the string that gets replaced by esbuild\n */\n// eslint-disable-next-line @typescript-eslint/no-inferrable-types\nexport const version: string = '6.0.4-next.edf5e96';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/structures/PatternCommand.ts"],"names":[],"mappings":";;;AAGO,IAAe,eAAA,GAAf,MAAe,eAAA,SAAuB,OAAsC,CAAA;AAAA,EAI3E,WAAA,CAAY,SAAuC,OAAiC,EAAA;AAC1F,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AAJvB,IAAgB,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA;AAChB,IAAgB,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA;AAChB,IAAgB,aAAA,CAAA,IAAA,EAAA,eAAA,CAAA;AAGf,IAAK,IAAA,CAAA,MAAA,GAAS,QAAQ,MAAU,IAAA,GAAA;AAChC,IAAA,IAAI,QAAQ,MAAQ,EAAA;AACnB,MAAI,IAAA,OAAA,CAAQ,SAAS,CAAG,EAAA;AACvB,QAAA,IAAA,CAAK,MAAS,GAAA,CAAA;AAAA,OACf,MAAA,IAAW,OAAQ,CAAA,MAAA,GAAS,EAAI,EAAA;AAC/B,QAAA,IAAA,CAAK,MAAS,GAAA,EAAA;AAAA,OACR,MAAA;AACN,QAAA,IAAA,CAAK,SAAS,OAAQ,CAAA,MAAA;AAAA;AACvB,KACM,MAAA;AACN,MAAA,IAAA,CAAK,MAAS,GAAA,CAAA;AAAA;AAEf,IAAK,IAAA,CAAA,aAAA,GAAgB,QAAQ,aAAiB,IAAA,KAAA;AAAA;AAQhD,CAAA;AA1BmF,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAA5E,IAAe,cAAf,GAAA","file":"PatternCommand.mjs","sourcesContent":["import { Args, Command, type MessageCommand } from '@sapphire/framework';\nimport type { Awaitable, Message } from 'discord.js';\n\nexport abstract class PatternCommand extends Command<Args, PatternCommand.Options> {\n\tpublic readonly chance: number;\n\tpublic readonly weight: number;\n\tpublic readonly matchFullName: boolean;\n\tpublic constructor(context: PatternCommand.LoaderContext, options: PatternCommand.Options) {\n\t\tsuper(context, options);\n\t\tthis.chance = options.chance ?? 100;\n\t\tif (options.weight) {\n\t\t\tif (options.weight < 0) {\n\t\t\t\tthis.weight = 0;\n\t\t\t} else if (options.weight > 10) {\n\t\t\t\tthis.weight = 10;\n\t\t\t} else {\n\t\t\t\tthis.weight = options.weight;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.weight = 5;\n\t\t}\n\t\tthis.matchFullName = options.matchFullName ?? false;\n\t}\n\n\t/**\n\t * Executes the pattern command's logic.\n\t * @param message The message that triggered the pattern command.\n\t */\n\tpublic abstract override messageRun(message: Message): Awaitable<unknown>;\n}\n\nexport interface PatternCommandOptions extends MessageCommand.Options {\n\t/**\n\t * The chance that the pattern command is triggered.\n\t * @default 100\n\t */\n\tchance?: number;\n\t/**\n\t * The matching weight of the command.\n\t * @default 5\n\t */\n\tweight?: number;\n\t/**\n\t * If true it will only trigger on full matches (for example, explore won't trigger lore)\n\t * Note: It will only change the behavior of the command's name and not for the command's aliasses\n\t * @default false\n\t */\n\tmatchFullName?: boolean;\n}\n\nexport namespace PatternCommand {\n\t/**\n\t * Re-export of {@link MessageCommand.LoaderContext}\n\t * @deprecated Use {@linkcode LoaderContext} instead.\n\t */\n\texport type Context = LoaderContext;\n\texport type LoaderContext = MessageCommand.LoaderContext;\n\n\t/** Re-export of {@link MessageCommand.RunContext} */\n\texport type RunContext = MessageCommand.RunContext;\n\n\t/** Re-export of {@link MessageCommand.JSON} */\n\texport type JSON = MessageCommand.JSON;\n\n\t/** Re-export of {@link MessageCommand.RunInTypes} */\n\texport type RunInTypes = MessageCommand.RunInTypes;\n\n\t/**\n\t * The PatternCommand Options\n\t */\n\texport type Options = PatternCommandOptions;\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/structures/PatternCommand.ts"],"names":[],"mappings":";;;AAGO,IAAe,eAAA,GAAf,MAAe,eAAA,SAAuB,OAAA,CAAsC;AAAA,EAI3E,WAAA,CAAY,SAAuC,OAAA,EAAiC;AAC1F,IAAA,KAAA,CAAM,SAAS,OAAO,CAAA;AAJvB,IAAA,aAAA,CAAA,IAAA,EAAgB,QAAA,CAAA;AAChB,IAAA,aAAA,CAAA,IAAA,EAAgB,QAAA,CAAA;AAChB,IAAA,aAAA,CAAA,IAAA,EAAgB,eAAA,CAAA;AAGf,IAAA,IAAA,CAAK,MAAA,GAAS,QAAQ,MAAA,IAAU,GAAA;AAChC,IAAA,IAAI,QAAQ,MAAA,EAAQ;AACnB,MAAA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACvB,QAAA,IAAA,CAAK,MAAA,GAAS,CAAA;AAAA,MACf,CAAA,MAAA,IAAW,OAAA,CAAQ,MAAA,GAAS,EAAA,EAAI;AAC/B,QAAA,IAAA,CAAK,MAAA,GAAS,EAAA;AAAA,MACf,CAAA,MAAO;AACN,QAAA,IAAA,CAAK,SAAS,OAAA,CAAQ,MAAA;AAAA,MACvB;AAAA,IACD,CAAA,MAAO;AACN,MAAA,IAAA,CAAK,MAAA,GAAS,CAAA;AAAA,IACf;AACA,IAAA,IAAA,CAAK,aAAA,GAAgB,QAAQ,aAAA,IAAiB,KAAA;AAAA,EAC/C;AAOD,CAAA;AA1BmF,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAA5E,IAAe,cAAA,GAAf","file":"PatternCommand.mjs","sourcesContent":["import { Args, Command, type MessageCommand } from '@sapphire/framework';\nimport type { Awaitable, Message } from 'discord.js';\n\nexport abstract class PatternCommand extends Command<Args, PatternCommand.Options> {\n\tpublic readonly chance: number;\n\tpublic readonly weight: number;\n\tpublic readonly matchFullName: boolean;\n\tpublic constructor(context: PatternCommand.LoaderContext, options: PatternCommand.Options) {\n\t\tsuper(context, options);\n\t\tthis.chance = options.chance ?? 100;\n\t\tif (options.weight) {\n\t\t\tif (options.weight < 0) {\n\t\t\t\tthis.weight = 0;\n\t\t\t} else if (options.weight > 10) {\n\t\t\t\tthis.weight = 10;\n\t\t\t} else {\n\t\t\t\tthis.weight = options.weight;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.weight = 5;\n\t\t}\n\t\tthis.matchFullName = options.matchFullName ?? false;\n\t}\n\n\t/**\n\t * Executes the pattern command's logic.\n\t * @param message The message that triggered the pattern command.\n\t */\n\tpublic abstract override messageRun(message: Message): Awaitable<unknown>;\n}\n\nexport interface PatternCommandOptions extends MessageCommand.Options {\n\t/**\n\t * The chance that the pattern command is triggered.\n\t * @default 100\n\t */\n\tchance?: number;\n\t/**\n\t * The matching weight of the command.\n\t * @default 5\n\t */\n\tweight?: number;\n\t/**\n\t * If true it will only trigger on full matches (for example, explore won't trigger lore)\n\t * Note: It will only change the behavior of the command's name and not for the command's aliasses\n\t * @default false\n\t */\n\tmatchFullName?: boolean;\n}\n\nexport namespace PatternCommand {\n\t/**\n\t * Re-export of {@link MessageCommand.LoaderContext}\n\t * @deprecated Use {@linkcode LoaderContext} instead.\n\t */\n\texport type Context = LoaderContext;\n\texport type LoaderContext = MessageCommand.LoaderContext;\n\n\t/** Re-export of {@link MessageCommand.RunContext} */\n\texport type RunContext = MessageCommand.RunContext;\n\n\t/** Re-export of {@link MessageCommand.JSON} */\n\texport type JSON = MessageCommand.JSON;\n\n\t/** Re-export of {@link MessageCommand.RunInTypes} */\n\texport type RunInTypes = MessageCommand.RunInTypes;\n\n\t/**\n\t * The PatternCommand Options\n\t */\n\texport type Options = PatternCommandOptions;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/structures/PatternCommandStore.ts"],"names":[],"mappings":";;;;AAGO,IAAM,oBAAA,GAAN,MAAM,oBAAA,SAA4B,UAA2B,CAAA;AAAA,EAC5D,WAAc,GAAA;AACpB,IAAA,KAAA,CAAM,cAAgB,EAAA,EAAE,IAAM,EAAA,kBAAA,EAAoB,CAAA;AAAA;AAEpD,CAAA;AAJoE,MAAA,CAAA,oBAAA,EAAA,qBAAA,CAAA;AAA7D,IAAM,mBAAN,GAAA","file":"PatternCommandStore.mjs","sourcesContent":["import { AliasStore } from '@sapphire/pieces';\nimport { PatternCommand } from './PatternCommand';\n\nexport class PatternCommandStore extends AliasStore<PatternCommand> {\n\tpublic constructor() {\n\t\tsuper(PatternCommand, { name: 'pattern-commands' });\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/structures/PatternCommandStore.ts"],"names":[],"mappings":";;;;AAGO,IAAM,oBAAA,GAAN,MAAM,oBAAA,SAA4B,UAAA,CAA2B;AAAA,EAC5D,WAAA,GAAc;AACpB,IAAA,KAAA,CAAM,cAAA,EAAgB,EAAE,IAAA,EAAM,kBAAA,EAAoB,CAAA;AAAA,EACnD;AACD,CAAA;AAJoE,MAAA,CAAA,oBAAA,EAAA,qBAAA,CAAA;AAA7D,IAAM,mBAAA,GAAN","file":"PatternCommandStore.mjs","sourcesContent":["import { AliasStore } from '@sapphire/pieces';\nimport { PatternCommand } from './PatternCommand';\n\nexport class PatternCommandStore extends AliasStore<PatternCommand> {\n\tpublic constructor() {\n\t\tsuper(PatternCommand, { name: 'pattern-commands' });\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/utils/PatternCommandEvents.ts"],"names":["PatternCommandEvents"],"mappings":";;;AAIY,IAAA,oBAAA,qBAAAA,qBAAL,KAAA;AAON,EAAAA,sBAAA,eAAgB,CAAA,GAAA,sBAAA;AAKhB,EAAAA,sBAAA,eAAgB,CAAA,GAAA,sBAAA;AAKhB,EAAAA,sBAAA,iBAAkB,CAAA,GAAA,wBAAA;AAMlB,EAAAA,sBAAA,eAAgB,CAAA,GAAA,sBAAA;AAOhB,EAAAA,sBAAA,YAAa,CAAA,GAAA,mBAAA;AAQb,EAAAA,sBAAA,gBAAiB,CAAA,GAAA,uBAAA;AAOjB,EAAAA,sBAAA,cAAe,CAAA,GAAA,qBAAA;AAOf,EAAAA,sBAAA,iBAAkB,CAAA,GAAA,wBAAA;AApDP,EAAAA,OAAAA,qBAAAA;AAAA,CAAA,EAAA,oBAAA,IAAA,EAAA","file":"PatternCommandEvents.mjs","sourcesContent":["/**\n * Events emitted during the parsing and command run.\n * You can use these events for debugging and logging purposes.\n */\nexport enum PatternCommandEvents {\n\t/**\n\t * Event that is emitted when the RNG doesn't love the command\n\t * @param message The message where the command was triggered\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t */\n\tCommandNoLuck = 'patternCommandNoLuck',\n\t/**\n\t * Event that is emitted when an alias triggered the command but before parsing the preconditions\n\t * @param payload PatternCommandRunPayload which contains message, command and alias\n\t */\n\tPreCommandRun = 'patternCommandPreRun',\n\t/**\n\t * Event that is emitted after the preconditions if none of them denied the command\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandAccepted = 'patternCommandAccepted',\n\t/**\n\t * Event that is emitted after the preconditions if at least one of them denied the command\n\t * @param error The error of the precondition which denied the command\n\t * @param payload PatternCommandDeniedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandDenied = 'patternCommandDenied',\n\t/**\n\t * Event that is emitted just before the command is ran\n\t * @param message The message where the command was triggered\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t */\n\tCommandRun = 'patternCommandRun',\n\t/**\n\t * Event that is emitted if there's no error while running the command\n\t * @param result The result of command's run\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t * @param duration The duration which indicates how long it took the command to run\n\t */\n\tCommandSuccess = 'patternCommandSuccess',\n\t/**\n\t * Event that is emitted if there's an error while running the command\n\t * @param error The error message which happened while the command was running\n\t * @param command The command's piece\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandError = 'patternCommandError',\n\t/**\n\t * Event that is emitted if the command has finished, regardless of whether an error occurred or not\n\t * @param command The command's piece\n\t * @param duration The duration which indicates how long it took the command to run\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandFinished = 'patternCommandFinished'\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/utils/PatternCommandEvents.ts"],"names":["PatternCommandEvents"],"mappings":";;;AAIO,IAAK,oBAAA,qBAAAA,qBAAAA,KAAL;AAON,EAAAA,sBAAA,eAAA,CAAA,GAAgB,sBAAA;AAKhB,EAAAA,sBAAA,eAAA,CAAA,GAAgB,sBAAA;AAKhB,EAAAA,sBAAA,iBAAA,CAAA,GAAkB,wBAAA;AAMlB,EAAAA,sBAAA,eAAA,CAAA,GAAgB,sBAAA;AAOhB,EAAAA,sBAAA,YAAA,CAAA,GAAa,mBAAA;AAQb,EAAAA,sBAAA,gBAAA,CAAA,GAAiB,uBAAA;AAOjB,EAAAA,sBAAA,cAAA,CAAA,GAAe,qBAAA;AAOf,EAAAA,sBAAA,iBAAA,CAAA,GAAkB,wBAAA;AApDP,EAAA,OAAAA,qBAAAA;AAAA,CAAA,EAAA,oBAAA,IAAA,EAAA","file":"PatternCommandEvents.mjs","sourcesContent":["/**\n * Events emitted during the parsing and command run.\n * You can use these events for debugging and logging purposes.\n */\nexport enum PatternCommandEvents {\n\t/**\n\t * Event that is emitted when the RNG doesn't love the command\n\t * @param message The message where the command was triggered\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t */\n\tCommandNoLuck = 'patternCommandNoLuck',\n\t/**\n\t * Event that is emitted when an alias triggered the command but before parsing the preconditions\n\t * @param payload PatternCommandRunPayload which contains message, command and alias\n\t */\n\tPreCommandRun = 'patternCommandPreRun',\n\t/**\n\t * Event that is emitted after the preconditions if none of them denied the command\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandAccepted = 'patternCommandAccepted',\n\t/**\n\t * Event that is emitted after the preconditions if at least one of them denied the command\n\t * @param error The error of the precondition which denied the command\n\t * @param payload PatternCommandDeniedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandDenied = 'patternCommandDenied',\n\t/**\n\t * Event that is emitted just before the command is ran\n\t * @param message The message where the command was triggered\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t */\n\tCommandRun = 'patternCommandRun',\n\t/**\n\t * Event that is emitted if there's no error while running the command\n\t * @param result The result of command's run\n\t * @param command The command's piece\n\t * @param alias The alias that triggered the command\n\t * @param duration The duration which indicates how long it took the command to run\n\t */\n\tCommandSuccess = 'patternCommandSuccess',\n\t/**\n\t * Event that is emitted if there's an error while running the command\n\t * @param error The error message which happened while the command was running\n\t * @param command The command's piece\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandError = 'patternCommandError',\n\t/**\n\t * Event that is emitted if the command has finished, regardless of whether an error occurred or not\n\t * @param command The command's piece\n\t * @param duration The duration which indicates how long it took the command to run\n\t * @param payload PatternCommandAcceptedPayload which contains parameters, context, message, command and alias\n\t */\n\tCommandFinished = 'patternCommandFinished'\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/listeners/PluginCommandAccepted.ts"],"names":["result"],"mappings":";;;;;AAKO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuB,QAAsD,CAAA;AAAA,EAClF,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAA,oBAAA,CAAqB,iBAAiB,CAAA;AAAA;AAC/D,EAEA,MAAsB,IAAI,OAAwC,EAAA;AACjE,IAAM,MAAA,EAAE,OAAS,EAAA,OAAA,EAAY,GAAA,OAAA;AAE7B,IAAA,MAAM,MAAS,GAAA,MAAM,MAAO,CAAA,SAAA,CAAU,YAAY;AACjD,MAAA,OAAA,CAAQ,OAAO,IAAK,CAAA,oBAAA,CAAqB,UAAY,EAAA,OAAA,EAAS,SAAS,OAAO,CAAA;AAE9E,MAAM,MAAA,SAAA,GAAY,IAAI,SAAU,EAAA;AAChC,MAAA,MAAMA,OAAS,GAAA,MAAM,OAAQ,CAAA,UAAA,CAAW,OAAO,CAAA;AAC/C,MAAA,MAAM,EAAE,QAAA,EAAa,GAAA,SAAA,CAAU,IAAK,EAAA;AAEpC,MAAQ,OAAA,CAAA,MAAA,CAAO,IAAK,CAAA,oBAAA,CAAqB,cAAgB,EAAA,EAAE,GAAG,OAAS,EAAA,MAAA,EAAAA,OAAQ,EAAA,QAAA,EAAU,CAAA;AAEzF,MAAO,OAAA,QAAA;AAAA,KACP,CAAA;AAED,IAAA,MAAA,CAAO,UAAW,CAAA,CAAC,KAAU,KAAA,OAAA,CAAQ,OAAO,IAAK,CAAA,oBAAA,CAAqB,YAAc,EAAA,KAAA,EAAO,EAAE,GAAG,OAAA,EAAS,QAAU,EAAA,EAAA,EAAI,CAAC,CAAA;AAExH,IAAA,OAAA,CAAQ,MAAO,CAAA,IAAA,CAAK,oBAAqB,CAAA,eAAA,EAAiB,SAAS,OAAS,EAAA;AAAA,MAC3E,GAAG,OAAA;AAAA,MACH,OAAA,EAAS,OAAO,IAAK,EAAA;AAAA,MACrB,QAAA,EAAU,MAAO,CAAA,QAAA,CAAS,EAAE;AAAA,KAC5B,CAAA;AAAA;AAEH,CAAA;AA5B0F,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAnF,IAAM,cAAN,GAAA","file":"PluginCommandAccepted.mjs","sourcesContent":["import { Listener, Result } from '@sapphire/framework';\nimport { Stopwatch } from '@sapphire/stopwatch';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PatternCommandAcceptedPayload } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof PatternCommandEvents.CommandAccepted> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: PatternCommandEvents.CommandAccepted });\n\t}\n\n\tpublic override async run(payload: PatternCommandAcceptedPayload) {\n\t\tconst { message, command } = payload;\n\n\t\tconst result = await Result.fromAsync(async () => {\n\t\t\tmessage.client.emit(PatternCommandEvents.CommandRun, message, command, payload);\n\n\t\t\tconst stopwatch = new Stopwatch();\n\t\t\tconst result = await command.messageRun(message);\n\t\t\tconst { duration } = stopwatch.stop();\n\n\t\t\tmessage.client.emit(PatternCommandEvents.CommandSuccess, { ...payload, result, duration });\n\n\t\t\treturn duration;\n\t\t});\n\n\t\tresult.inspectErr((error) => message.client.emit(PatternCommandEvents.CommandError, error, { ...payload, duration: -1 }));\n\n\t\tmessage.client.emit(PatternCommandEvents.CommandFinished, message, command, {\n\t\t\t...payload,\n\t\t\tsuccess: result.isOk(),\n\t\t\tduration: result.unwrapOr(-1)\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/listeners/PluginCommandAccepted.ts"],"names":["result"],"mappings":";;;;;AAKO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuB,QAAA,CAAsD;AAAA,EAClF,YAAY,OAAA,EAAiC;AACnD,IAAA,KAAA,CAAM,OAAA,EAAS,EAAE,KAAA,EAAO,oBAAA,CAAqB,iBAAiB,CAAA;AAAA,EAC/D;AAAA,EAEA,MAAsB,IAAI,OAAA,EAAwC;AACjE,IAAA,MAAM,EAAE,OAAA,EAAS,OAAA,EAAQ,GAAI,OAAA;AAE7B,IAAA,MAAM,MAAA,GAAS,MAAM,MAAA,CAAO,SAAA,CAAU,YAAY;AACjD,MAAA,OAAA,CAAQ,OAAO,IAAA,CAAK,oBAAA,CAAqB,UAAA,EAAY,OAAA,EAAS,SAAS,OAAO,CAAA;AAE9E,MAAA,MAAM,SAAA,GAAY,IAAI,SAAA,EAAU;AAChC,MAAA,MAAMA,OAAAA,GAAS,MAAM,OAAA,CAAQ,UAAA,CAAW,OAAO,CAAA;AAC/C,MAAA,MAAM,EAAE,QAAA,EAAS,GAAI,SAAA,CAAU,IAAA,EAAK;AAEpC,MAAA,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAK,oBAAA,CAAqB,cAAA,EAAgB,EAAE,GAAG,OAAA,EAAS,MAAA,EAAAA,OAAAA,EAAQ,QAAA,EAAU,CAAA;AAEzF,MAAA,OAAO,QAAA;AAAA,IACR,CAAC,CAAA;AAED,IAAA,MAAA,CAAO,UAAA,CAAW,CAAC,KAAA,KAAU,OAAA,CAAQ,OAAO,IAAA,CAAK,oBAAA,CAAqB,YAAA,EAAc,KAAA,EAAO,EAAE,GAAG,OAAA,EAAS,QAAA,EAAU,EAAA,EAAI,CAAC,CAAA;AAExH,IAAA,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAK,oBAAA,CAAqB,eAAA,EAAiB,SAAS,OAAA,EAAS;AAAA,MAC3E,GAAG,OAAA;AAAA,MACH,OAAA,EAAS,OAAO,IAAA,EAAK;AAAA,MACrB,QAAA,EAAU,MAAA,CAAO,QAAA,CAAS,EAAE;AAAA,KAC5B,CAAA;AAAA,EACF;AACD,CAAA;AA5B0F,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAnF,IAAM,cAAA,GAAN","file":"PluginCommandAccepted.mjs","sourcesContent":["import { Listener, Result } from '@sapphire/framework';\nimport { Stopwatch } from '@sapphire/stopwatch';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PatternCommandAcceptedPayload } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof PatternCommandEvents.CommandAccepted> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: PatternCommandEvents.CommandAccepted });\n\t}\n\n\tpublic override async run(payload: PatternCommandAcceptedPayload) {\n\t\tconst { message, command } = payload;\n\n\t\tconst result = await Result.fromAsync(async () => {\n\t\t\tmessage.client.emit(PatternCommandEvents.CommandRun, message, command, payload);\n\n\t\t\tconst stopwatch = new Stopwatch();\n\t\t\tconst result = await command.messageRun(message);\n\t\t\tconst { duration } = stopwatch.stop();\n\n\t\t\tmessage.client.emit(PatternCommandEvents.CommandSuccess, { ...payload, result, duration });\n\n\t\t\treturn duration;\n\t\t});\n\n\t\tresult.inspectErr((error) => message.client.emit(PatternCommandEvents.CommandError, error, { ...payload, duration: -1 }));\n\n\t\tmessage.client.emit(PatternCommandEvents.CommandFinished, message, command, {\n\t\t\t...payload,\n\t\t\tsuccess: result.isOk(),\n\t\t\tduration: result.unwrapOr(-1)\n\t\t});\n\t}\n}\n"]}
@@ -40,7 +40,7 @@ var _PluginListener = class _PluginListener extends Listener {
40
40
  });
41
41
  continue;
42
42
  }
43
- if (content.match(new RegExp(patternCommand.matchFullName ? `\b${key}\b` : key, client.options.caseInsensitiveCommands ? "i" : undefined))) {
43
+ if (content.match(new RegExp(patternCommand.matchFullName ? `\b${key}\b` : key, client.options.caseInsensitiveCommands ? "i" : void 0))) {
44
44
  possiblePatternCommands.push({
45
45
  command: patternCommand,
46
46
  alias: content,
@@ -49,7 +49,7 @@ var _PluginListener = class _PluginListener extends Listener {
49
49
  continue;
50
50
  }
51
51
  const aliasRegexMatch = patternCommand.aliases.find(
52
- (alias) => content.match(new RegExp(alias, client.options.caseInsensitiveCommands ? "i" : undefined))
52
+ (alias) => content.match(new RegExp(alias, client.options.caseInsensitiveCommands ? "i" : void 0))
53
53
  );
54
54
  if (aliasRegexMatch) {
55
55
  possiblePatternCommands.push({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/listeners/PluginMessageParse.ts"],"names":[],"mappings":";;;;;;AAOO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuB,QAAyC,CAAA;AAAA,EAErE,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAA,MAAA,CAAO,kBAAkB,CAAA;AAFlD,IAAiB,aAAA,CAAA,IAAA,EAAA,qBAAA,EAAsB,IAAI,mBAAA,CAAoB,CAAC,mBAAA,CAAoB,aAAa,mBAAoB,CAAA,YAAY,CAAC,CAAA,CAAE,MAAO,EAAA,CAAA;AAAA;AAG3I,EAEA,MAAsB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AACxB,IAAA,OAAO,QAAQ,cAAe,CAAA,EAAE,EAAE,GAAI,CAAA,IAAA,CAAK,qBAAqB,KAAK,CAAA;AAAA;AAEvE,CAAA;AAzF6E,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAtE,IAAM,cAAN,GAAA","file":"PluginMessageParse.mjs","sourcesContent":["import { isDMChannel, type GuildBasedChannelTypes } from '@sapphire/discord.js-utilities';\nimport { Events, Listener } from '@sapphire/framework';\nimport { Message, PermissionFlagsBits, PermissionsBitField } from 'discord.js';\nimport type { PatternCommandStore } from '../lib/structures/PatternCommandStore';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PossiblePatternCommand } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof Events.PreMessageParsed> {\n\tprivate readonly requiredPermissions = new PermissionsBitField([PermissionFlagsBits.ViewChannel, PermissionFlagsBits.SendMessages]).freeze();\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: Events.PreMessageParsed });\n\t}\n\n\tpublic override async run(message: Message) {\n\t\tconst canRun = await this.canRunInChannel(message);\n\t\tif (!canRun) return;\n\n\t\tlet { content } = message;\n\t\tconst { client, stores } = this.container;\n\n\t\tconst patternCommandStore = stores.get('pattern-commands') as PatternCommandStore | undefined;\n\n\t\tif (!patternCommandStore) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (client.options.caseInsensitiveCommands) {\n\t\t\tcontent = content.toLowerCase();\n\t\t}\n\n\t\tconst possiblePatternCommands: PossiblePatternCommand[] = [];\n\n\t\tfor (const [key, patternCommand] of patternCommandStore) {\n\t\t\tif (content === key) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: key,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst aliasMatch = patternCommand.aliases.find((alias) => alias === content);\n\n\t\t\tif (aliasMatch) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: aliasMatch,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontent.match(new RegExp(patternCommand.matchFullName ? `\\b${key}\\b` : key, client.options.caseInsensitiveCommands ? 'i' : undefined))\n\t\t\t) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: content,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst aliasRegexMatch = patternCommand.aliases.find((alias) =>\n\t\t\t\tcontent.match(new RegExp(alias, client.options.caseInsensitiveCommands ? 'i' : undefined))\n\t\t\t);\n\n\t\t\tif (aliasRegexMatch) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: aliasRegexMatch,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (possiblePatternCommands.length > 0) {\n\t\t\tconst sortedPossiblePatternCommands = possiblePatternCommands.sort((first, second) => {\n\t\t\t\treturn second.weight - first.weight;\n\t\t\t});\n\n\t\t\tclient.emit(PatternCommandEvents.PreCommandRun, { message, possibleCommands: sortedPossiblePatternCommands });\n\t\t}\n\t}\n\n\tprivate async canRunInChannel(message: Message): Promise<boolean> {\n\t\tif (isDMChannel(message.channel)) return true;\n\n\t\tconst me = await message.guild?.members.fetchMe();\n\t\tif (!me) return false;\n\n\t\tconst channel = message.channel as GuildBasedChannelTypes;\n\t\treturn channel.permissionsFor(me).has(this.requiredPermissions, false);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/listeners/PluginMessageParse.ts"],"names":[],"mappings":";;;;;;AAOO,IAAM,eAAA,GAAN,MA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AAK,oBAAA,CAAqB,aAAA,EAAe,EAAE,OAAA,EAAS,gBAAA,EAAkB,+BAA+B,CAAA;AAAA,IAC7G;AAAA,EACD;AAAA,EAEA,MAAc,gBAAgB,OAAA,EAAoC;AACjE,IAAA,IAAI,WAAA,CAAY,OAAA,CAAQ,OAAO,CAAA,EAAG,OAAO,IAAA;AAEzC,IAAA,MAAM,EAAA,GAAK,MAAM,OAAA,CAAQ,KAAA,EAAO,QAAQ,OAAA,EAAQ;AAChD,IAAA,IAAI,CAAC,IAAI,OAAO,KAAA;AAEhB,IAAA,MAAM,UAAU,OAAA,CAAQ,OAAA;AACxB,IAAA,OAAO,QAAQ,cAAA,CAAe,EAAE,EAAE,GAAA,CAAI,IAAA,CAAK,qBAAqB,KAAK,CAAA;AAAA,EACtE;AACD,CAAA;AAzF6E,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAtE,IAAM,cAAA,GAAN","file":"PluginMessageParse.mjs","sourcesContent":["import { isDMChannel, type GuildBasedChannelTypes } from '@sapphire/discord.js-utilities';\nimport { Events, Listener } from '@sapphire/framework';\nimport { Message, PermissionFlagsBits, PermissionsBitField } from 'discord.js';\nimport type { PatternCommandStore } from '../lib/structures/PatternCommandStore';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PossiblePatternCommand } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof Events.PreMessageParsed> {\n\tprivate readonly requiredPermissions = new PermissionsBitField([PermissionFlagsBits.ViewChannel, PermissionFlagsBits.SendMessages]).freeze();\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: Events.PreMessageParsed });\n\t}\n\n\tpublic override async run(message: Message) {\n\t\tconst canRun = await this.canRunInChannel(message);\n\t\tif (!canRun) return;\n\n\t\tlet { content } = message;\n\t\tconst { client, stores } = this.container;\n\n\t\tconst patternCommandStore = stores.get('pattern-commands') as PatternCommandStore | undefined;\n\n\t\tif (!patternCommandStore) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (client.options.caseInsensitiveCommands) {\n\t\t\tcontent = content.toLowerCase();\n\t\t}\n\n\t\tconst possiblePatternCommands: PossiblePatternCommand[] = [];\n\n\t\tfor (const [key, patternCommand] of patternCommandStore) {\n\t\t\tif (content === key) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: key,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst aliasMatch = patternCommand.aliases.find((alias) => alias === content);\n\n\t\t\tif (aliasMatch) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: aliasMatch,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontent.match(new RegExp(patternCommand.matchFullName ? `\\b${key}\\b` : key, client.options.caseInsensitiveCommands ? 'i' : undefined))\n\t\t\t) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: content,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst aliasRegexMatch = patternCommand.aliases.find((alias) =>\n\t\t\t\tcontent.match(new RegExp(alias, client.options.caseInsensitiveCommands ? 'i' : undefined))\n\t\t\t);\n\n\t\t\tif (aliasRegexMatch) {\n\t\t\t\tpossiblePatternCommands.push({\n\t\t\t\t\tcommand: patternCommand,\n\t\t\t\t\talias: aliasRegexMatch,\n\t\t\t\t\tweight: patternCommand.weight\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (possiblePatternCommands.length > 0) {\n\t\t\tconst sortedPossiblePatternCommands = possiblePatternCommands.sort((first, second) => {\n\t\t\t\treturn second.weight - first.weight;\n\t\t\t});\n\n\t\t\tclient.emit(PatternCommandEvents.PreCommandRun, { message, possibleCommands: sortedPossiblePatternCommands });\n\t\t}\n\t}\n\n\tprivate async canRunInChannel(message: Message): Promise<boolean> {\n\t\tif (isDMChannel(message.channel)) return true;\n\n\t\tconst me = await message.guild?.members.fetchMe();\n\t\tif (!me) return false;\n\n\t\tconst channel = message.channel as GuildBasedChannelTypes;\n\t\treturn channel.permissionsFor(me).has(this.requiredPermissions, false);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/listeners/PluginPreCommandRun.ts"],"names":[],"mappings":";;;;AAIO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuB,QAAoD,CAAA;AAAA,EAChF,YAAY,OAAiC,EAAA;AACnD,IAAA,KAAA,CAAM,OAAS,EAAA,EAAE,KAAO,EAAA,oBAAA,CAAqB,eAAe,CAAA;AAAA;AAC7D,EAEA,MAAsB,IAAI,OAAmC,EAAA;AAC5D,IAAM,MAAA,EAAE,OAAS,EAAA,gBAAA,EAAqB,GAAA,OAAA;AAEtC,IAAA,KAAA,MAAW,mBAAmB,gBAAkB,EAAA;AAC/C,MAAM,MAAA,EAAE,SAAY,GAAA,eAAA;AACpB,MAAA,MAAM,cAAwC,GAAA;AAAA,QAC7C,OAAA;AAAA,QACA,OAAA;AAAA,QACA,OAAO,eAAgB,CAAA;AAAA,OACxB;AAGA,MAAA,MAAM,eAAe,MAAO,IAAA,CAAK,UAAU,MAAO,CAAA,GAAA,CAAI,eAAe,CAAmC,CAAA,UAAA;AAAA,QACvG,OAAA;AAAA,QACA,OAAA;AAAA,QACA;AAAA,OACD;AAEA,MAAI,IAAA,YAAA,CAAa,OAAS,EAAA;AACzB,QAAA,OAAA,CAAQ,OAAO,IAAK,CAAA,oBAAA,CAAqB,eAAe,YAAa,CAAA,SAAA,IAAa,cAAc,CAAA;AAChG,QAAA;AAAA;AAID,MAAA,MAAM,cAAc,MAAM,OAAA,CAAQ,cAAc,UAAW,CAAA,OAAA,EAAS,SAAS,OAAc,CAAA;AAC3F,MAAI,IAAA,WAAA,CAAY,OAAS,EAAA;AACxB,QAAA,OAAA,CAAQ,OAAO,IAAK,CAAA,oBAAA,CAAqB,eAAe,WAAY,CAAA,SAAA,IAAa,cAAc,CAAA;AAC/F,QAAA;AAAA;AAGD,MAAI,IAAA,OAAA,CAAQ,UAAU,IAAK,CAAA,KAAA,CAAM,KAAK,MAAO,EAAA,GAAI,EAAE,CAAA,GAAI,CAAG,EAAA;AACzD,QAAA,OAAA,CAAQ,MAAO,CAAA,IAAA,CAAK,oBAAqB,CAAA,eAAA,EAAiB,cAAc,CAAA;AACxE,QAAA;AAAA,OACM,MAAA;AACN,QAAA,OAAA,CAAQ,MAAO,CAAA,IAAA,CAAK,oBAAqB,CAAA,aAAA,EAAe,cAAc,CAAA;AAAA;AACvE;AACD;AAEF,CAAA;AA3CwF,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAjF,IAAM,cAAN,GAAA","file":"PluginPreCommandRun.mjs","sourcesContent":["import { Listener, type PreconditionStore } from '@sapphire/framework';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PatternCommandPayload, PatternCommandPrePayload } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof PatternCommandEvents.PreCommandRun> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: PatternCommandEvents.PreCommandRun });\n\t}\n\n\tpublic override async run(payload: PatternCommandPrePayload) {\n\t\tconst { message, possibleCommands } = payload;\n\n\t\tfor (const possibleCommand of possibleCommands) {\n\t\t\tconst { command } = possibleCommand;\n\t\t\tconst commandPayload: PatternCommandPayload = {\n\t\t\t\tmessage,\n\t\t\t\tcommand,\n\t\t\t\talias: possibleCommand.alias\n\t\t\t};\n\n\t\t\t// Run global preconditions:\n\t\t\tconst globalResult = await (this.container.stores.get('preconditions') as unknown as PreconditionStore).messageRun(\n\t\t\t\tmessage,\n\t\t\t\tcommand,\n\t\t\t\tcommandPayload as any\n\t\t\t);\n\n\t\t\tif (globalResult.isErr()) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandDenied, globalResult.unwrapErr(), commandPayload);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Run command-specific preconditions:\n\t\t\tconst localResult = await command.preconditions.messageRun(message, command, payload as any);\n\t\t\tif (localResult.isErr()) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandDenied, localResult.unwrapErr(), commandPayload);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (command.chance >= Math.round(Math.random() * 99) + 1) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandAccepted, commandPayload);\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandNoLuck, commandPayload);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/listeners/PluginPreCommandRun.ts"],"names":[],"mappings":";;;;AAIO,IAAM,eAAA,GAAN,MAAM,eAAA,SAAuB,QAAA,CAAoD;AAAA,EAChF,YAAY,OAAA,EAAiC;AACnD,IAAA,KAAA,CAAM,OAAA,EAAS,EAAE,KAAA,EAAO,oBAAA,CAAqB,eAAe,CAAA;AAAA,EAC7D;AAAA,EAEA,MAAsB,IAAI,OAAA,EAAmC;AAC5D,IAAA,MAAM,EAAE,OAAA,EAAS,gBAAA,EAAiB,GAAI,OAAA;AAEtC,IAAA,KAAA,MAAW,mBAAmB,gBAAA,EAAkB;AAC/C,MAAA,MAAM,EAAE,SAAQ,GAAI,eAAA;AACpB,MAAA,MAAM,cAAA,GAAwC;AAAA,QAC7C,OAAA;AAAA,QACA,OAAA;AAAA,QACA,OAAO,eAAA,CAAgB;AAAA,OACxB;AAGA,MAAA,MAAM,eAAe,MAAO,IAAA,CAAK,UAAU,MAAA,CAAO,GAAA,CAAI,eAAe,CAAA,CAAmC,UAAA;AAAA,QACvG,OAAA;AAAA,QACA,OAAA;AAAA,QACA;AAAA,OACD;AAEA,MAAA,IAAI,YAAA,CAAa,OAAM,EAAG;AACzB,QAAA,OAAA,CAAQ,OAAO,IAAA,CAAK,oBAAA,CAAqB,eAAe,YAAA,CAAa,SAAA,IAAa,cAAc,CAAA;AAChG,QAAA;AAAA,MACD;AAGA,MAAA,MAAM,cAAc,MAAM,OAAA,CAAQ,cAAc,UAAA,CAAW,OAAA,EAAS,SAAS,OAAc,CAAA;AAC3F,MAAA,IAAI,WAAA,CAAY,OAAM,EAAG;AACxB,QAAA,OAAA,CAAQ,OAAO,IAAA,CAAK,oBAAA,CAAqB,eAAe,WAAA,CAAY,SAAA,IAAa,cAAc,CAAA;AAC/F,QAAA;AAAA,MACD;AAEA,MAAA,IAAI,OAAA,CAAQ,UAAU,IAAA,CAAK,KAAA,CAAM,KAAK,MAAA,EAAO,GAAI,EAAE,CAAA,GAAI,CAAA,EAAG;AACzD,QAAA,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAK,oBAAA,CAAqB,eAAA,EAAiB,cAAc,CAAA;AACxE,QAAA;AAAA,MACD,CAAA,MAAO;AACN,QAAA,OAAA,CAAQ,MAAA,CAAO,IAAA,CAAK,oBAAA,CAAqB,aAAA,EAAe,cAAc,CAAA;AAAA,MACvE;AAAA,IACD;AAAA,EACD;AACD,CAAA;AA3CwF,MAAA,CAAA,eAAA,EAAA,gBAAA,CAAA;AAAjF,IAAM,cAAA,GAAN","file":"PluginPreCommandRun.mjs","sourcesContent":["import { Listener, type PreconditionStore } from '@sapphire/framework';\nimport { PatternCommandEvents } from '../lib/utils/PatternCommandEvents';\nimport type { PatternCommandPayload, PatternCommandPrePayload } from '../lib/utils/PatternCommandInterfaces';\n\nexport class PluginListener extends Listener<typeof PatternCommandEvents.PreCommandRun> {\n\tpublic constructor(context: Listener.LoaderContext) {\n\t\tsuper(context, { event: PatternCommandEvents.PreCommandRun });\n\t}\n\n\tpublic override async run(payload: PatternCommandPrePayload) {\n\t\tconst { message, possibleCommands } = payload;\n\n\t\tfor (const possibleCommand of possibleCommands) {\n\t\t\tconst { command } = possibleCommand;\n\t\t\tconst commandPayload: PatternCommandPayload = {\n\t\t\t\tmessage,\n\t\t\t\tcommand,\n\t\t\t\talias: possibleCommand.alias\n\t\t\t};\n\n\t\t\t// Run global preconditions:\n\t\t\tconst globalResult = await (this.container.stores.get('preconditions') as unknown as PreconditionStore).messageRun(\n\t\t\t\tmessage,\n\t\t\t\tcommand,\n\t\t\t\tcommandPayload as any\n\t\t\t);\n\n\t\t\tif (globalResult.isErr()) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandDenied, globalResult.unwrapErr(), commandPayload);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Run command-specific preconditions:\n\t\t\tconst localResult = await command.preconditions.messageRun(message, command, payload as any);\n\t\t\tif (localResult.isErr()) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandDenied, localResult.unwrapErr(), commandPayload);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (command.chance >= Math.round(Math.random() * 99) + 1) {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandAccepted, commandPayload);\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tmessage.client.emit(PatternCommandEvents.CommandNoLuck, commandPayload);\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/listeners/_load.ts"],"names":["PluginCommandAccepted","PluginMessageParse","PluginPreCommandRun"],"mappings":";;;;;;AAKO,SAAS,aAAgB,GAAA;AAC/B,EAAA,MAAM,KAAQ,GAAA,WAAA;AACd,EAAK,KAAA,SAAA,CAAU,OAAO,SAAU,CAAA,EAAE,MAAM,uBAAyB,EAAA,KAAA,EAAOA,cAAuB,EAAA,KAAA,EAAO,CAAA;AACtG,EAAK,KAAA,SAAA,CAAU,OAAO,SAAU,CAAA,EAAE,MAAM,oBAAsB,EAAA,KAAA,EAAOC,gBAAoB,EAAA,KAAA,EAAO,CAAA;AAChG,EAAK,KAAA,SAAA,CAAU,OAAO,SAAU,CAAA,EAAE,MAAM,qBAAuB,EAAA,KAAA,EAAOC,gBAAqB,EAAA,KAAA,EAAO,CAAA;AACnG;AALgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"_load.mjs","sourcesContent":["import { container } from '@sapphire/pieces';\nimport { PluginListener as PluginCommandAccepted } from './PluginCommandAccepted';\nimport { PluginListener as PluginMessageParse } from './PluginMessageParse';\nimport { PluginListener as PluginPreCommandRun } from './PluginPreCommandRun';\n\nexport function loadListeners() {\n\tconst store = 'listeners' as const;\n\tvoid container.stores.loadPiece({ name: 'PluginCommandAccepted', piece: PluginCommandAccepted, store });\n\tvoid container.stores.loadPiece({ name: 'PluginMessageParse', piece: PluginMessageParse, store });\n\tvoid container.stores.loadPiece({ name: 'PluginPreCommandRun', piece: PluginPreCommandRun, store });\n}\n"]}
1
+ {"version":3,"sources":["../../../src/listeners/_load.ts"],"names":["PluginCommandAccepted","PluginMessageParse","PluginPreCommandRun"],"mappings":";;;;;;AAKO,SAAS,aAAA,GAAgB;AAC/B,EAAA,MAAM,KAAA,GAAQ,WAAA;AACd,EAAA,KAAK,SAAA,CAAU,OAAO,SAAA,CAAU,EAAE,MAAM,uBAAA,EAAyB,KAAA,EAAOA,cAAA,EAAuB,KAAA,EAAO,CAAA;AACtG,EAAA,KAAK,SAAA,CAAU,OAAO,SAAA,CAAU,EAAE,MAAM,oBAAA,EAAsB,KAAA,EAAOC,gBAAA,EAAoB,KAAA,EAAO,CAAA;AAChG,EAAA,KAAK,SAAA,CAAU,OAAO,SAAA,CAAU,EAAE,MAAM,qBAAA,EAAuB,KAAA,EAAOC,gBAAA,EAAqB,KAAA,EAAO,CAAA;AACnG;AALgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"_load.mjs","sourcesContent":["import { container } from '@sapphire/pieces';\nimport { PluginListener as PluginCommandAccepted } from './PluginCommandAccepted';\nimport { PluginListener as PluginMessageParse } from './PluginMessageParse';\nimport { PluginListener as PluginPreCommandRun } from './PluginPreCommandRun';\n\nexport function loadListeners() {\n\tconst store = 'listeners' as const;\n\tvoid container.stores.loadPiece({ name: 'PluginCommandAccepted', piece: PluginCommandAccepted, store });\n\tvoid container.stores.loadPiece({ name: 'PluginMessageParse', piece: PluginMessageParse, store });\n\tvoid container.stores.loadPiece({ name: 'PluginPreCommandRun', piece: PluginPreCommandRun, store });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;AASO,IAAM,qBAAA,GAAN,MAAM,qBAAA,SAA6B,MAAO,CAAA;AAAA;AAAA;AAAA;AAAA,EAIhD,QAAe,kBAAkB,CAAA,CAAwB,QAA+B,EAAA;AACvF,IAAA,IAAA,CAAK,MAAO,CAAA,QAAA,CAAS,IAAI,mBAAA,EAAqB,CAAA;AAC9C,IAAc,aAAA,EAAA;AAAA;AAEhB,CAAA;AARiD,MAAA,CAAA,qBAAA,EAAA,sBAAA,CAAA;AAA1C,IAAM,oBAAN,GAAA;AAUP,cAAA,CAAe,OAAQ,CAAA,8BAAA,CAA+B,oBAAqB,CAAA,kBAAkB,GAAG,oCAAoC,CAAA","file":"register.mjs","sourcesContent":["import './index';\n\nimport { Plugin, postInitialization, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { loadListeners, PatternCommandStore } from './index';\n\n/**\n * @since 1.0.0\n */\nexport class PatternCommandPlugin extends Plugin {\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static [postInitialization](this: SapphireClient, _options: ClientOptions): void {\n\t\tthis.stores.register(new PatternCommandStore());\n\t\tloadListeners();\n\t}\n}\n\nSapphireClient.plugins.registerPostInitializationHook(PatternCommandPlugin[postInitialization], 'Pattern-Command-PostInitialization');\n"]}
1
+ {"version":3,"sources":["../../src/register.ts"],"names":[],"mappings":";;;;AASO,IAAM,qBAAA,GAAN,MAAM,qBAAA,SAA6B,MAAA,CAAO;AAAA;AAAA;AAAA;AAAA,EAIhD,QAAwB,kBAAkB,CAAA,CAAwB,QAAA,EAA+B;AAChG,IAAA,IAAA,CAAK,MAAA,CAAO,QAAA,CAAS,IAAI,mBAAA,EAAqB,CAAA;AAC9C,IAAA,aAAA,EAAc;AAAA,EACf;AACD,CAAA;AARiD,MAAA,CAAA,qBAAA,EAAA,sBAAA,CAAA;AAA1C,IAAM,oBAAA,GAAN;AAUP,cAAA,CAAe,OAAA,CAAQ,8BAAA,CAA+B,oBAAA,CAAqB,kBAAkB,GAAG,oCAAoC,CAAA","file":"register.mjs","sourcesContent":["import './index';\n\nimport { Plugin, postInitialization, SapphireClient } from '@sapphire/framework';\nimport type { ClientOptions } from 'discord.js';\nimport { loadListeners, PatternCommandStore } from './index';\n\n/**\n * @since 1.0.0\n */\nexport class PatternCommandPlugin extends Plugin {\n\t/**\n\t * @since 1.0.0\n\t */\n\tpublic static override [postInitialization](this: SapphireClient, _options: ClientOptions): void {\n\t\tthis.stores.register(new PatternCommandStore());\n\t\tloadListeners();\n\t}\n}\n\nSapphireClient.plugins.registerPostInitializationHook(PatternCommandPlugin[postInitialization], 'Pattern-Command-PostInitialization');\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/plugin-pattern-commands",
3
- "version": "6.0.4-next.ebf804c",
3
+ "version": "6.0.4-next.edf5e96",
4
4
  "description": "Plugin for @sapphire/framework that adds support for pattern commands.",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -80,11 +80,11 @@
80
80
  "devDependencies": {
81
81
  "@favware/cliff-jumper": "^6.0.0",
82
82
  "@favware/rollup-type-bundler": "^4.0.0",
83
- "concurrently": "^9.1.2",
84
- "tsup": "^8.3.5",
85
- "tsx": "^4.19.2",
86
- "typedoc": "^0.26.11",
83
+ "concurrently": "^9.2.1",
84
+ "tsup": "^8.5.1",
85
+ "tsx": "^4.21.0",
86
+ "typedoc": "^0.28.14",
87
87
  "typedoc-json-parser": "^10.2.0",
88
- "typescript": "~5.4.5"
88
+ "typescript": "~5.9.3"
89
89
  }
90
90
  }