From 88c32e5d355087ccee1118d56b9542dcc3338bfb Mon Sep 17 00:00:00 2001 From: Shigma Date: Tue, 30 Jan 2024 03:09:59 +0800 Subject: [PATCH] fix(protocol): fix adapter satori content encoding --- adapters/satori/package.json | 2 +- adapters/satori/src/bot.ts | 15 ++++++++++----- adapters/satori/src/ws.ts | 3 +++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/adapters/satori/package.json b/adapters/satori/package.json index 36bff695..5752f057 100644 --- a/adapters/satori/package.json +++ b/adapters/satori/package.json @@ -1,7 +1,7 @@ { "name": "@satorijs/adapter-satori", "description": "Satori Adapter for Satorijs", - "version": "1.0.3", + "version": "1.0.8", "main": "lib/index.js", "typings": "lib/index.d.ts", "files": [ diff --git a/adapters/satori/src/bot.ts b/adapters/satori/src/bot.ts index c6fe78ef..93ebf3ce 100644 --- a/adapters/satori/src/bot.ts +++ b/adapters/satori/src/bot.ts @@ -1,4 +1,4 @@ -import { Bot, Context, Quester, snakeCase, Universal } from '@satorijs/satori' +import { Bot, Context, h, Quester, snakeCase, Universal } from '@satorijs/satori' export function transformKey(source: any, callback: (key: string) => string) { if (!source || typeof source !== 'object') return source @@ -28,17 +28,22 @@ export class SatoriBot extends Bot extends Adapter.WsClient return bot.dispose() } const session = bot.session(parsed.body) + if (parsed.body.message?.content) { + session.content = parsed.body.message.content + } if (parsed.body._type && parsed.body.type !== 'internal') { session.setInternal(parsed.body._type, parsed.body._data) }