fix: unify stream cleanup and configuration response handling
This commit is contained in:
1 parent
38a7c3da63
commit
1faa6c58fa
13 files changed
+463
-247
No files matched your search
@@ -45,7 +45,11 @@ function normalizeNotifications(raw: unknown): { channelIds: string[] } {
|
||||
* into the canonical {@link OneBotConfig} the editor expects.
|
||||
*/
|
||||
export function normalizeOneBotConfig(raw: unknown): OneBotConfig {
|
||||
const cfg = (raw ?? {}) as Record<string, unknown>;
|
||||
if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
|
||||
throw new Error('服务端返回了无效的配置');
|
||||
}
|
||||
|
||||
const cfg = raw as Record<string, unknown>;
|
||||
const nets = (cfg.networks as Record<string, unknown> | undefined) ?? {};
|
||||
const legacyFormat: MessageFormat = cfg.messageFormat === 'string' ? 'string' : 'array';
|
||||
const legacyReport = !!cfg.reportSelfMessage;
|
||||
|
||||
Reference in new issue
Block a user