diff --git a/package.json b/package.json index 9b6ae7b..6e79665 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "koishi-plugin-twdne", "description": "Send Random Anime Avatars in Koishi ([This Waifu Does Not Exist](https://www.thiswaifudoesnotexist.net/))", - "version": "1.1.1", + "version": "1.2.1", "main": "lib/index.js", "typings": "lib/index.d.ts", "files": [ @@ -39,15 +39,20 @@ "description": { "en": "Send Random Anime Avatars ([This Waifu Does Not Exist](https://www.thiswaifudoesnotexist.net/))", "zh": "发送随机动漫头像 (基于 [This Waifu Does Not Exist](https://www.thiswaifudoesnotexist.net/))" + }, + "service": { + "required": [ + "http" + ] } }, "peerDependencies": { - "koishi": "^4.8.3" + "koishi": "^4.18.0" }, "devDependencies": { - "@types/node": "^17.0.45", - "atsc": "^1.1.1", - "koishi": "^4.8.5", - "typescript": "^4.7.4" + "@types/node": "^22.10.1", + "atsc": "^2.1.0", + "koishi": "^4.18.0", + "typescript": "^5.7.2" } } diff --git a/src/index.ts b/src/index.ts index 9ef8e9d..ce6651d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,14 @@ import { Context, Random, Schema, segment } from 'koishi' +import {} from '@koishijs/plugin-http' const BASE_URL = 'https://www.thiswaifudoesnotexist.net/example-{0}.jpg' +export const name = 'TWDNE' + +export const inject = ['http'] + export interface Config {} -export const name = 'TWDNE' export const Config: Schema = Schema.object({}) export function apply(ctx: Context) { @@ -15,6 +19,6 @@ export function apply(ctx: Context) { const data = await ctx.http.get(BASE_URL.replace('{0}', '' + id), { responseType: 'arraybuffer', }) - return segment.image(data) + return segment.image(data, 'image/jpeg') }) }