Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
clansty committed Jul 12, 2024
1 parent 6ce58f6 commit 460428c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions main/src/client/NapCatClient/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class NapCatClient extends QQClient {
} : undefined,
undefined,
data.message_id.toString(),
replyMessage.sender.user_id === this.uin || message.some(it => it.type === 'at' && it.data.qq === this.uin),
replyMessage?.sender.user_id === this.uin || message.some(it => it.type === 'at' && it.data.qq === this.uin),
message.some(it => it.type === 'at' && (it.data.qq === 0 || it.data.qq === 'all')),
);
for (const handler of this.onMessageHandlers) {
Expand Down Expand Up @@ -183,7 +183,7 @@ export class NapCatClient extends QQClient {
public async getFriendsWithCluster(): Promise<{ name: string; friends: Friend[]; }[]> {
const data = await this.callApi('get_friends_with_category');
return data.map(it => ({
name: it.categoryName,
name: it.categoryName || (it as any).categroyName, // typo in API
friends: it.buddyList.map(friend => NapCatFriend.createExisted(this, {
nickname: friend.nick,
uid: parseInt(friend.uin),
Expand Down
9 changes: 7 additions & 2 deletions main/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ import posthog from './models/posthog';
const log = getLogger('Main');

process.on('unhandledRejection', error => {
log.error('UnhandledException: ', error);
posthog.capture('UnhandledException', { error });
log.error('UnhandledRejection: ', error);
posthog.capture('UnhandledRejection', { error });
});

process.on('uncaughtException', error => {
log.error('UncaughtException: ', error);
posthog.capture('UncaughtException', { error });
});

await api.startListening();
Expand Down
2 changes: 1 addition & 1 deletion main/src/services/ConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class ConfigService {
public async addFriend() {
const friends = await this.oicq.getFriendsWithCluster();
await (await this.owner).createPaginatedInlineSelector('选择分组', friends.map(e => [
Button.inline(e.name, this.tgBot.registerCallback(
Button.inline(e.name || '(未知名称)', this.tgBot.registerCallback(
() => this.openFriendSelection(e.friends, e.name),
)),
]));
Expand Down

0 comments on commit 460428c

Please sign in to comment.