Commit acd8ba84 authored by nanahira's avatar nanahira

add preferFile

parent 734f28a6
......@@ -20,6 +20,12 @@ export class PicsPluginConfig {
@SchemaProperty({ type: Quester.createSchema(), default: {} })
httpConfig: Quester.Config;
@SchemaProperty({
description: 'OneBot 机器人永远使用 file 字段。',
default: false,
})
preferFile: boolean;
}
export type PicsPluginConfigLike = Partial<PicsPluginConfig>;
......
......@@ -234,8 +234,10 @@ export default class PicsContainer
async getSegment(url: string, bot?: Bot) {
url = await this.resolveUrl(url);
const picData: segment.Data = {
[url.startsWith('base64://') && this.isOneBotBot(bot) ? 'file' : 'url']:
url,
[url.startsWith('base64://') &&
(this.isOneBotBot(bot) || this.config.preferFile)
? 'file'
: 'url']: url,
cache: true,
};
return segment('image', picData);
......
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