Commit 09e894b3 authored by nanahira's avatar nanahira

add param for PutArgv

parent c712a338
...@@ -197,11 +197,10 @@ function PutCommandParam<T extends keyof CommandPutConfigMap>( ...@@ -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) => export const PutSession = (field?: keyof Session) =>
field field ? PutCommandParam('sessionField', field) : PutArgv('session');
? PutCommandParam('sessionField', field)
: PutCommandParam('argvField', 'session');
export const PutArg = (i: number) => PutCommandParam('arg', i); export const PutArg = (i: number) => PutCommandParam('arg', i);
export const PutArgs = () => PutCommandParam('args'); export const PutArgs = () => PutCommandParam('args');
export const PutOption = ( export const PutOption = (
...@@ -226,7 +225,7 @@ export const PutChannelId = () => PutSession('channelId'); ...@@ -226,7 +225,7 @@ export const PutChannelId = () => PutSession('channelId');
export const PutChannelName = () => PutSession('channelName'); export const PutChannelName = () => PutSession('channelName');
export const PutSelfId = () => PutSession('selfId'); export const PutSelfId = () => PutSession('selfId');
export const PutBot = () => PutSession('bot'); export const PutBot = () => PutSession('bot');
export const PutNext = () => PutCommandParam('argvField', 'next'); export const PutNext = () => PutArgv('next');
// Service // Service
......
...@@ -179,7 +179,9 @@ export function DefinePlugin<T = any>( ...@@ -179,7 +179,9 @@ export function DefinePlugin<T = any>(
} }
} }
return ( return (
argv.session.author?.nickname || argv.session.author?.username argv.session.author?.nickname ||
argv.session.author?.username ||
argv.session.userId
); );
case 'sessionField': case 'sessionField':
const { data: field } = config as CommandPutConfig<'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