Skip to content

Commit

Permalink
fix: fix legacy api usage
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Dec 9, 2024
1 parent fb2a5a0 commit 4e777f5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down Expand Up @@ -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"
}
}
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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<Config> = Schema.object({})

export function apply(ctx: Context) {
Expand All @@ -15,6 +19,6 @@ export function apply(ctx: Context) {
const data = await ctx.http.get<ArrayBuffer>(BASE_URL.replace('{0}', '' + id), {
responseType: 'arraybuffer',
})
return segment.image(data)
return segment.image(data, 'image/jpeg')
})
}

0 comments on commit 4e777f5

Please sign in to comment.