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) => {
|
||||
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);
|
||||
if (pair) return false;
|
||||
// 如果正在创建中,应该阻塞
|
||||
|
|
|
@ -22,7 +22,7 @@ export default class ConfigService {
|
|||
private readonly tgBot: Telegram,
|
||||
private readonly tgUser: Telegram,
|
||||
private readonly oicq: OicqClient) {
|
||||
this.log = getLogger(`ConfigService - ${instance.id}`)
|
||||
this.log = getLogger(`ConfigService - ${instance.id}`);
|
||||
this.owner = tgBot.getChat(this.instance.owner);
|
||||
}
|
||||
|
||||
|
@ -231,6 +231,7 @@ export default class ConfigService {
|
|||
}
|
||||
catch (e) {
|
||||
message = `错误:<code>${e}</code>`;
|
||||
this.log.error(e);
|
||||
}
|
||||
await (await this.owner).sendMessage({ message });
|
||||
}
|
||||
|
@ -295,11 +296,11 @@ export default class ConfigService {
|
|||
return text + `\n\n由 @${this.tgBot.me.username} 管理`;
|
||||
}
|
||||
|
||||
public async migrateAllChats(){
|
||||
public async migrateAllChats() {
|
||||
const dbPairs = await db.forwardPair.findMany();
|
||||
for (const forwardPair of dbPairs) {
|
||||
const chatForUser = await this.tgUser.getChat(Number(forwardPair.tgChatId))
|
||||
if(chatForUser.entity instanceof Api.Chat){
|
||||
const chatForUser = await this.tgUser.getChat(Number(forwardPair.tgChatId));
|
||||
if (chatForUser.entity instanceof Api.Chat) {
|
||||
this.log.info('升级群组 ', chatForUser.id);
|
||||
await chatForUser.migrate();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue