Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions packages/core/src/command/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,6 @@ export namespace Argv {
}
}

// assign default values
for (const { name, fallback } of Object.values(this._options)) {
if (fallback !== undefined && !(name in options)) {
options[name] = fallback
}
}

delete argv.tokens
return { ...argv, options, args, error: argv.error || '', command: this as any }
}
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,13 @@ export class Session<U extends User.Field = never, G extends Channel.Field = nev
const { command } = argv
if (!command.ctx.filter(this)) return ''

// assign default values
for (const { name, fallback } of Object.values(command._options)) {
if (fallback !== undefined && !(name in argv.options)) {
argv.options[name] = fallback
}
}

if (this.app.database) {
if (!this.isDirect) {
await this.observeChannel(this.collect('channel', argv, new Set(['permissions', 'locales'])))
Expand Down