Commit bca85756 authored by nanahira's avatar nanahira

remove onebot adapt

parent 02490c32
...@@ -130,24 +130,18 @@ export class SendTarget { ...@@ -130,24 +130,18 @@ export class SendTarget {
if (!bot) { if (!bot) {
throw new Error(`bot ${this.bot} not found`); throw new Error(`bot ${this.bot} not found`);
} }
let privateContent = content;
let channelContent = content;
if (this.isOneBotBot(bot)) {
privateContent = this.replaceContent(content, 'url', 'file'); // private should be file
channelContent = this.replaceContent(content, 'file', 'url'); // channel should be url
}
return _.flatten( return _.flatten(
await Promise.all([ await Promise.all([
...this.users.map((userId) => ...this.users.map((userId) =>
bot.sendPrivateMessage bot.sendPrivateMessage
? bot.sendPrivateMessage(userId, privateContent) ? bot.sendPrivateMessage(userId, content)
: bot.sendMessage(`@${userId}`, privateContent), : bot.sendMessage(`@${userId}`, content),
), ),
...(this.channels?.length ...(this.channels?.length
? [ ? [
bot.broadcast( bot.broadcast(
this.channels.map((c) => c.toDesc()), this.channels.map((c) => c.toDesc()),
channelContent, content,
), ),
] ]
: []), : []),
......
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