@@ -109,6 +109,24 @@ export default class TelegramExecutionContext {
109109 }
110110 }
111111
112+ async sendTyping ( ) {
113+ switch ( this . update_type ) {
114+ case 'message' :
115+ return await this . api . sendChatAction ( this . bot . api . toString ( ) , {
116+ chat_id : this . update . message ?. chat . id . toString ( ) ?? '' ,
117+ action : 'typing' ,
118+ } ) ;
119+ case 'business_message' :
120+ return await this . api . sendChatAction ( this . bot . api . toString ( ) , {
121+ business_connection_id : this . update . business_message ?. business_connection_id . toString ( ) ,
122+ chat_id : this . update . business_message ?. chat . id . toString ( ) ?? '' ,
123+ action : 'typing' ,
124+ } ) ;
125+ default :
126+ break ;
127+ }
128+ }
129+
112130 /**
113131 * Reply to the last message with text
114132 * @param message - text to reply with
@@ -118,10 +136,6 @@ export default class TelegramExecutionContext {
118136 async reply ( message : string , parse_mode = '' , options : Record < string , number | string | boolean > = { } ) {
119137 switch ( this . update_type ) {
120138 case 'message' :
121- await this . api . sendChatAction ( this . bot . api . toString ( ) , {
122- chat_id : this . update . message ?. chat . id . toString ( ) ?? '' ,
123- action : 'typing' ,
124- } ) ;
125139 return await this . api . sendMessage ( this . bot . api . toString ( ) , {
126140 ...options ,
127141 chat_id : this . update . message ?. chat . id . toString ( ) ?? '' ,
@@ -130,11 +144,6 @@ export default class TelegramExecutionContext {
130144 parse_mode,
131145 } ) ;
132146 case 'business_message' :
133- await this . api . sendChatAction ( this . bot . api . toString ( ) , {
134- business_connection_id : this . update . business_message ?. business_connection_id . toString ( ) ,
135- chat_id : this . update . business_message ?. chat . id . toString ( ) ?? '' ,
136- action : 'typing' ,
137- } ) ;
138147 return await this . api . sendMessage ( this . bot . api . toString ( ) , {
139148 chat_id : this . update . business_message ?. chat . id . toString ( ) ?? '' ,
140149 text : message ,
0 commit comments