Commit d2787c1a authored by nanahira's avatar nanahira

update fragment handling

parent 050433dc
import { PromptOptions, Random, Session } from 'koishi';
import {
Fragment,
PromptOptions,
Random,
segment,
SendOptions,
Session,
} from 'koishi';
import ApiBot from './index';
import { Prompt } from './def/prompt';
export class ApiSession extends Session {
storedMessages: string[] = [];
private midResolver: () => void;
......@@ -39,8 +45,13 @@ export class ApiSession extends Session {
}
}
async send(content: string) {
this.storedMessages.push(content);
async send(content: Fragment, options: SendOptions = {}) {
if (!content) return;
options.session = this;
const children = await this.transform(segment.normalize(content));
this.storedMessages.push(
children.map((child) => child.toString()).join(''),
);
return [Random.id()];
}
......
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