opc-agent 4.0.7 → 4.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/channels/telegram.js +12 -2
- package/package.json +1 -1
- package/src/channels/telegram.ts +12 -2
|
@@ -169,8 +169,18 @@ class TelegramChannel extends index_1.BaseChannel {
|
|
|
169
169
|
chatType: message.chat.type,
|
|
170
170
|
},
|
|
171
171
|
};
|
|
172
|
-
|
|
173
|
-
await this.
|
|
172
|
+
// Show typing indicator while processing
|
|
173
|
+
await this.apiCall('sendChatAction', { chat_id: message.chat.id, action: 'typing' });
|
|
174
|
+
const typingInterval = setInterval(() => {
|
|
175
|
+
this.apiCall('sendChatAction', { chat_id: message.chat.id, action: 'typing' }).catch(() => { });
|
|
176
|
+
}, 4000);
|
|
177
|
+
try {
|
|
178
|
+
const response = await this.handler(msg);
|
|
179
|
+
await this.sendMessage(message.chat.id, response.content);
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
clearInterval(typingInterval);
|
|
183
|
+
}
|
|
174
184
|
}
|
|
175
185
|
async sendMessage(chatId, text) {
|
|
176
186
|
// Telegram max message length is 4096
|
package/package.json
CHANGED
package/src/channels/telegram.ts
CHANGED
|
@@ -170,8 +170,18 @@ export class TelegramChannel extends BaseChannel {
|
|
|
170
170
|
},
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
await this.
|
|
173
|
+
// Show typing indicator while processing
|
|
174
|
+
await this.apiCall('sendChatAction', { chat_id: message.chat.id, action: 'typing' });
|
|
175
|
+
const typingInterval = setInterval(() => {
|
|
176
|
+
this.apiCall('sendChatAction', { chat_id: message.chat.id, action: 'typing' }).catch(() => {});
|
|
177
|
+
}, 4000);
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
const response = await this.handler(msg);
|
|
181
|
+
await this.sendMessage(message.chat.id, response.content);
|
|
182
|
+
} finally {
|
|
183
|
+
clearInterval(typingInterval);
|
|
184
|
+
}
|
|
175
185
|
}
|
|
176
186
|
|
|
177
187
|
async sendMessage(chatId: number | string, text: string): Promise<void> {
|