Commit b0c8f84b authored by nanahira's avatar nanahira

support segment

parent ede8d039
This diff is collapsed.
......@@ -68,6 +68,6 @@
"testEnvironment": "node"
},
"peerDependencies": {
"koishi": "^4.8.7"
"koishi": "^4.9.1"
}
}
import { Argv, Command, Context, Dict, I18n } from 'koishi';
import { Argv, Command, Context, Dict, I18n, segment } from 'koishi';
import { CanBeObserved } from '../utility/rxjs-session';
type CommandReg<A extends any[] = any[], R = any> = (
......@@ -85,4 +85,4 @@ export interface CommandOptionConfig {
config?: CommandOptionConfigWithDescription;
}
export type CommandReturnType = CanBeObserved<string | void>;
export type CommandReturnType = CanBeObserved<string | void | segment>;
import { Awaitable, Session } from 'koishi';
import { Awaitable, Session, segment } from 'koishi';
import { isObservable, Observable } from 'rxjs';
export type CanBeObserved<T> = Awaitable<T | Observable<T>>;
export async function sessionRxToPromise(
session: Session,
obs: CanBeObserved<string | void>,
obs: CanBeObserved<string | void | segment>,
) {
const obsAwaited = await obs;
if (!isObservable(obsAwaited)) {
......
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