-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Instance from '../models/Instance'; | ||
import Telegram from '../client/Telegram'; | ||
import { InputStatusChangeEvent, QQClient } from '../client/QQClient'; | ||
import flags from '../constants/flags'; | ||
import { Api } from 'telegram'; | ||
|
||
export default class TypingController { | ||
constructor(private readonly instance: Instance, | ||
private readonly tgBot: Telegram, | ||
private readonly tgUser: Telegram, | ||
private readonly oicq: QQClient) { | ||
oicq.addInputStatusChangeHandler(this.handleInputStatusChange); | ||
} | ||
|
||
private handleInputStatusChange = async (event: InputStatusChangeEvent) => { | ||
const pair = this.instance.forwardPairs.find(event.chat); | ||
if (!pair) return; | ||
if (pair.flags & flags.DISABLE_Q2TG) return; | ||
|
||
if (event.typing) { | ||
console.log(await pair.tg.setTyping()) | ||
|
||
} | ||
else { | ||
await pair.tg.setTyping(new Api.SendMessageCancelAction()); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters