Commit 09e894b3 authored by nanahira's avatar nanahira

add param for PutArgv

parent c712a338
......@@ -197,11 +197,10 @@ function PutCommandParam<T extends keyof CommandPutConfigMap>(
};
}
export const PutArgv = () => PutCommandParam('argv');
export const PutArgv = (field?: keyof Argv) =>
field ? PutCommandParam('argvField', field) : PutCommandParam('argv');
export const PutSession = (field?: keyof Session) =>
field
? PutCommandParam('sessionField', field)
: PutCommandParam('argvField', 'session');
field ? PutCommandParam('sessionField', field) : PutArgv('session');
export const PutArg = (i: number) => PutCommandParam('arg', i);
export const PutArgs = () => PutCommandParam('args');
export const PutOption = (
......@@ -226,7 +225,7 @@ export const PutChannelId = () => PutSession('channelId');
export const PutChannelName = () => PutSession('channelName');
export const PutSelfId = () => PutSession('selfId');
export const PutBot = () => PutSession('bot');
export const PutNext = () => PutCommandParam('argvField', 'next');
export const PutNext = () => PutArgv('next');
// Service
......
......@@ -179,7 +179,9 @@ export function DefinePlugin<T = any>(
}
}
return (
argv.session.author?.nickname || argv.session.author?.username
argv.session.author?.nickname ||
argv.session.author?.username ||
argv.session.userId
);
case 'sessionField':
const { data: field } = config as CommandPutConfig<'sessionField'>;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment