Commit bf922743 authored by nanahira's avatar nanahira

allow first bot

parent fd35594b
......@@ -17,8 +17,8 @@ export class ChannelTarget {
@RegisterSchema()
export class SendTarget {
@SchemaProperty({
required: true,
description: 'Bot identifier. eg. onebot:123456789. ',
description:
'Bot identifier. eg. onebot:123456789. Will use first bot if not specified.',
})
bot: string;
......@@ -36,6 +36,14 @@ export class SendTarget {
})
channels: ChannelTarget[];
private getBot(bots: Adapter.BotList) {
if (this.bot) {
return bots.get(this.bot);
} else {
return bots.find((bot) => bot['parentBot']?.platform !== 'onebot');
}
}
async send(bots: Adapter.BotList, content: string) {
const bot = bots.get(this.bot);
if (!bot) {
......
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