@fraqjs/fraq 0.13.1 → 0.13.3
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.
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +5 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -316,7 +316,7 @@ var Router = class Router {
|
|
|
316
316
|
for (const branch of this.branchesFrom(session, [], { includeHidden: true })) {
|
|
317
317
|
const literalActivationIndex = branch.type === "rawPattern" ? Object.values(branch.rawPattern.pattern).findIndex((parameter) => parameter.capturer.typeInstruction.type === "literal") : -1;
|
|
318
318
|
let activationInputs = DEFAULT_ACTIVATIONS;
|
|
319
|
-
if (branch.type === "command" || literalActivationIndex !== -1) {
|
|
319
|
+
if (branch.type === "command" || literalActivationIndex !== -1 || branch.path.length > 0) {
|
|
320
320
|
const descriptor = this.describeBranch(branch);
|
|
321
321
|
const activations = this.activationResolver(descriptor, session) ?? DEFAULT_ACTIVATIONS;
|
|
322
322
|
activationInputs = Array.isArray(activations) ? activations : [activations];
|
|
@@ -366,12 +366,14 @@ var Router = class Router {
|
|
|
366
366
|
consumeActivation(tokenizer, activation, session) {
|
|
367
367
|
switch (activation.type) {
|
|
368
368
|
case "direct": return true;
|
|
369
|
-
case "mention":
|
|
369
|
+
case "mention":
|
|
370
|
+
if (!tokenizer.consumeMention(session.selfId)) return false;
|
|
371
|
+
return activation.prefix === void 0 || tokenizer.consumeTextPrefix(activation.prefix);
|
|
370
372
|
case "prefix": return tokenizer.consumeTextPrefix(activation.prefix);
|
|
371
373
|
}
|
|
372
374
|
}
|
|
373
375
|
matchBranch(branch, tokenizer, activation, session, literalActivationIndex) {
|
|
374
|
-
if (branch.type === "command" && !this.consumeActivation(tokenizer, activation, session)) return;
|
|
376
|
+
if ((branch.type === "command" || branch.type === "rawPattern" && branch.path.length > 0 && literalActivationIndex === -1) && !this.consumeActivation(tokenizer, activation, session)) return;
|
|
375
377
|
if (!this.matchPath(branch.path, tokenizer)) return;
|
|
376
378
|
switch (branch.type) {
|
|
377
379
|
case "command": return this.matchCommand(branch.command, tokenizer, branch.path, activation);
|