Skip to content

Commit

Permalink
fix(core): fix edge case of empty prefix and at others
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Dec 22, 2023
1 parent 976ac6f commit 1a15aa6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/core/src/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export class Commander extends Map<string, Command> {
})

ctx.before('attach', (session) => {
const { hasAt, appel } = session.stripped
if (!appel && hasAt) return

// strip prefix
let content = session.stripped.content
for (const prefix of this._resolvePrefixes(session)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class Session<U extends User.Field = never, G extends Channel.Field = nev
atSelf = appel = true
}
// quote messages may contain mentions
if (this.quote?.user?.id && this.quote.user.id !== attrs.id) {
if (!this.quote?.user?.id || this.quote.user.id !== attrs.id) {
hasAt = true
}
// @ts-ignore
Expand Down

0 comments on commit 1a15aa6

Please sign in to comment.