@gonzih/cc-tg 0.5.0 → 0.5.2

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.
Files changed (2) hide show
  1. package/dist/bot.js +7 -5
  2. package/package.json +1 -1
package/dist/bot.js CHANGED
@@ -372,7 +372,7 @@ export class CcTgBot {
372
372
  if (!fileId)
373
373
  return;
374
374
  console.log(`[voice:${chatId}] received voice message, transcribing...`);
375
- this.bot.sendChatAction(chatId, "typing").catch(() => { });
375
+ this.bot.sendChatAction(chatId, "typing", threadId !== undefined ? { message_thread_id: threadId } : undefined).catch(() => { });
376
376
  try {
377
377
  const fileLink = await this.bot.getFileLink(fileId);
378
378
  const transcript = await transcribeVoice(fileLink);
@@ -405,7 +405,7 @@ export class CcTgBot {
405
405
  const best = photos[photos.length - 1];
406
406
  const caption = msg.caption?.trim();
407
407
  console.log(`[photo:${chatId}] received image file_id=${best.file_id}`);
408
- this.bot.sendChatAction(chatId, "typing").catch(() => { });
408
+ this.bot.sendChatAction(chatId, "typing", threadId !== undefined ? { message_thread_id: threadId } : undefined).catch(() => { });
409
409
  try {
410
410
  const fileLink = await this.bot.getFileLink(best.file_id);
411
411
  const imageData = await fetchAsBase64(fileLink);
@@ -424,7 +424,7 @@ export class CcTgBot {
424
424
  const caption = msg.caption?.trim();
425
425
  const fileName = doc.file_name ?? `file_${doc.file_id}`;
426
426
  console.log(`[doc:${chatId}] received document file_name=${fileName} mime=${doc.mime_type}`);
427
- this.bot.sendChatAction(chatId, "typing").catch(() => { });
427
+ this.bot.sendChatAction(chatId, "typing", threadId !== undefined ? { message_thread_id: threadId } : undefined).catch(() => { });
428
428
  try {
429
429
  const uploadsDir = join(this.opts.cwd ?? process.cwd(), ".cc-tg", "uploads");
430
430
  mkdirSync(uploadsDir, { recursive: true });
@@ -586,9 +586,11 @@ export class CcTgBot {
586
586
  startTyping(chatId, session) {
587
587
  this.stopTyping(session);
588
588
  // Send immediately, then keep alive every 4s
589
- this.bot.sendChatAction(chatId, "typing").catch(() => { });
589
+ // Pass message_thread_id so typing appears in the correct forum topic thread
590
+ const threadOpts = session.threadId !== undefined ? { message_thread_id: session.threadId } : undefined;
591
+ this.bot.sendChatAction(chatId, "typing", threadOpts).catch(() => { });
590
592
  session.typingTimer = setInterval(() => {
591
- this.bot.sendChatAction(chatId, "typing").catch(() => { });
593
+ this.bot.sendChatAction(chatId, "typing", threadOpts).catch(() => { });
592
594
  }, TYPING_INTERVAL_MS);
593
595
  }
594
596
  stopTyping(session) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonzih/cc-tg",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Claude Code Telegram bot — chat with Claude Code via Telegram",
5
5
  "type": "module",
6
6
  "bin": {