mirror of https://github.com/Nofated095/Q2TG.git
fix: 群组模式不应该响应好友消息
This commit is contained in:
parent
c44cec4aa0
commit
3c7f261e70
|
@ -91,7 +91,7 @@ export default class ConfigController {
|
||||||
};
|
};
|
||||||
|
|
||||||
private handleQqMessage = async (message: GroupMessageEvent | PrivateMessageEvent) => {
|
private handleQqMessage = async (message: GroupMessageEvent | PrivateMessageEvent) => {
|
||||||
if (message.message_type !== 'private') return false;
|
if (message.message_type !== 'private' || this.instance.workMode === 'group') return false;
|
||||||
const pair = this.instance.forwardPairs.find(message.friend);
|
const pair = this.instance.forwardPairs.find(message.friend);
|
||||||
if (pair) return false;
|
if (pair) return false;
|
||||||
// 如果正在创建中,应该阻塞
|
// 如果正在创建中,应该阻塞
|
||||||
|
|
|
@ -22,7 +22,7 @@ export default class ConfigService {
|
||||||
private readonly tgBot: Telegram,
|
private readonly tgBot: Telegram,
|
||||||
private readonly tgUser: Telegram,
|
private readonly tgUser: Telegram,
|
||||||
private readonly oicq: OicqClient) {
|
private readonly oicq: OicqClient) {
|
||||||
this.log = getLogger(`ConfigService - ${instance.id}`)
|
this.log = getLogger(`ConfigService - ${instance.id}`);
|
||||||
this.owner = tgBot.getChat(this.instance.owner);
|
this.owner = tgBot.getChat(this.instance.owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,6 +231,7 @@ export default class ConfigService {
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
message = `错误:<code>${e}</code>`;
|
message = `错误:<code>${e}</code>`;
|
||||||
|
this.log.error(e);
|
||||||
}
|
}
|
||||||
await (await this.owner).sendMessage({ message });
|
await (await this.owner).sendMessage({ message });
|
||||||
}
|
}
|
||||||
|
@ -298,7 +299,7 @@ export default class ConfigService {
|
||||||
public async migrateAllChats() {
|
public async migrateAllChats() {
|
||||||
const dbPairs = await db.forwardPair.findMany();
|
const dbPairs = await db.forwardPair.findMany();
|
||||||
for (const forwardPair of dbPairs) {
|
for (const forwardPair of dbPairs) {
|
||||||
const chatForUser = await this.tgUser.getChat(Number(forwardPair.tgChatId))
|
const chatForUser = await this.tgUser.getChat(Number(forwardPair.tgChatId));
|
||||||
if (chatForUser.entity instanceof Api.Chat) {
|
if (chatForUser.entity instanceof Api.Chat) {
|
||||||
this.log.info('升级群组 ', chatForUser.id);
|
this.log.info('升级群组 ', chatForUser.id);
|
||||||
await chatForUser.migrate();
|
await chatForUser.migrate();
|
||||||
|
|
Loading…
Reference in New Issue