Commit 4f01350c authored by nanahira's avatar nanahira

no more onebot adapt

parent 32510325
...@@ -228,16 +228,9 @@ export default class PicsContainer ...@@ -228,16 +228,9 @@ export default class PicsContainer
} }
} }
async getSegment(url: string, bot?: Bot) { async getSegment(url: string) {
url = await this.resolveUrl(url); url = await this.resolveUrl(url);
const picData = { return segment.image(url);
[(url.startsWith('base64://') && this.isOneBotBot(bot)) ||
this.config.preferFile
? 'file'
: 'url']: url,
cache: 'true',
};
return segment('image', picData, []);
} }
private installDefaultMiddlewares() { private installDefaultMiddlewares() {
...@@ -278,7 +271,6 @@ export default class PicsContainer ...@@ -278,7 +271,6 @@ export default class PicsContainer
@PutOption('source', `-s <source>`) source: string, @PutOption('source', `-s <source>`) source: string,
@PutArgs() picTags: string[], @PutArgs() picTags: string[],
@PutRenderer('.not-found') notFound: Renderer, @PutRenderer('.not-found') notFound: Renderer,
@PutBot() bot: Bot,
) { ) {
const sourceTags = source?.split(/[ ,+\uFF0C\uFF0B\u3001]/) || []; const sourceTags = source?.split(/[ ,+\uFF0C\uFF0B\u3001]/) || [];
picTags ||= []; picTags ||= [];
...@@ -287,7 +279,7 @@ export default class PicsContainer ...@@ -287,7 +279,7 @@ export default class PicsContainer
return notFound(); return notFound();
} }
let msg = (await this.getSegment(result.url, bot)).toString(); let msg = (await this.getSegment(result.url)).toString();
if (result.description) { if (result.description) {
msg += `\n${result.description}`; msg += `\n${result.description}`;
} }
......
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