opencode-telegram-mirror 0.5.0 → 0.5.1
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/package.json +1 -1
- package/src/main.ts +21 -2
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -496,6 +496,16 @@ interface TelegramUpdate {
|
|
|
496
496
|
mime_type?: string
|
|
497
497
|
file_size?: number
|
|
498
498
|
}
|
|
499
|
+
video?: {
|
|
500
|
+
file_id: string
|
|
501
|
+
file_unique_id: string
|
|
502
|
+
duration: number
|
|
503
|
+
}
|
|
504
|
+
video_note?: {
|
|
505
|
+
file_id: string
|
|
506
|
+
file_unique_id: string
|
|
507
|
+
duration: number
|
|
508
|
+
}
|
|
499
509
|
from?: { id: number; username?: string }
|
|
500
510
|
chat: { id: number }
|
|
501
511
|
}
|
|
@@ -694,7 +704,7 @@ async function handleTelegramMessage(
|
|
|
694
704
|
msg: NonNullable<TelegramUpdate["message"]>,
|
|
695
705
|
) {
|
|
696
706
|
const messageText = msg.text || msg.caption
|
|
697
|
-
if (!messageText && !msg.photo && !msg.voice) return
|
|
707
|
+
if (!messageText && !msg.photo && !msg.voice && !msg.video && !msg.video_note) return
|
|
698
708
|
|
|
699
709
|
// Ignore all bot messages - context is sent directly via OpenCode API
|
|
700
710
|
if (msg.from?.id === state.botUserId) {
|
|
@@ -901,6 +911,14 @@ async function handleTelegramMessage(
|
|
|
901
911
|
}
|
|
902
912
|
}
|
|
903
913
|
|
|
914
|
+
if (msg.video || msg.video_note) {
|
|
915
|
+
log("info", "Rejecting video message - not supported")
|
|
916
|
+
await state.telegram.sendMessage(
|
|
917
|
+
"Video files are not supported. Please send screenshots or audio files instead."
|
|
918
|
+
)
|
|
919
|
+
return
|
|
920
|
+
}
|
|
921
|
+
|
|
904
922
|
// Build prompt parts
|
|
905
923
|
const parts: Array<
|
|
906
924
|
| { type: "text"; text: string }
|
|
@@ -977,7 +995,8 @@ async function handleTelegramMessage(
|
|
|
977
995
|
|
|
978
996
|
const transcribedText = transcriptionResult.value
|
|
979
997
|
log("info", "Voice transcribed", { preview: transcribedText.slice(0, 50) })
|
|
980
|
-
|
|
998
|
+
const voiceContext = `[Voice message transcript - may contain transcription inaccuracies]\n\n${transcribedText}`
|
|
999
|
+
parts.push({ type: "text", text: voiceContext })
|
|
981
1000
|
}
|
|
982
1001
|
|
|
983
1002
|
if (messageText) {
|