Skip to content

Commit

Permalink
fix: import error
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Jul 12, 2024
1 parent f486bf9 commit 4388d45
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main/src/client/QQClient/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import OicqClient, { CreateOicqParams } from '../OicqClient';
import { CreateOicqParams } from '../OicqClient';
import { Friend, Group } from './entity';
import {
FriendIncreaseEvent,
Expand All @@ -8,7 +8,7 @@ import {
MessageRecallEvent, PokeEvent,
} from './events';
import type { FriendRequestEvent, GroupInviteEvent, ImageElem, MessageElem } from '@icqqjs/icqq';
import { CreateNapCatParams, NapCatClient } from '../NapCatClient';
import { CreateNapCatParams } from '../NapCatClient';

export * from './events';
export * from './entity';
Expand Down Expand Up @@ -40,18 +40,23 @@ export abstract class QQClient {
}

let client: Promise<QQClient>;
let clientType: {
create(params: CreateQQClientParams): Promise<QQClient>;
};

switch (params.type) {
case 'oicq':
client = OicqClient.create(params);
clientType = require('../OicqClient').default;
break;
case 'napcat':
client = NapCatClient.create(params);
clientType = require('../NapCatClient').NapCatClient;
break;
default:
throw new Error('Unknown client type');
}

client = clientType.create(params);

this.existedBots[params.id] = client;
return client;
}
Expand Down

0 comments on commit 4388d45

Please sign in to comment.