Skip to content

Fix: голосовые сообщения приходили как [вложение: UNSUPPORTED] - #2

Draft
erop39 wants to merge 4 commits into
mainfrom
cursor/fix-audio-voice-ec4d
Draft

Fix: голосовые сообщения приходили как [вложение: UNSUPPORTED]#2
erop39 wants to merge 4 commits into
mainfrom
cursor/fix-audio-voice-ec4d

Conversation

@erop39

@erop39 erop39 commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Проблема

Голосовые из Max пересылались в Telegram как [вложение: UNSUPPORTED].

Причина

  1. Max отправляет голосовые с _type: UNSUPPORTED (или AUDIO), а не с прямой ссылкой url.
  2. Аудио идентифицируется полем token (иногда audioId, duration, wave).
  3. Старый код обрабатывал только AUDIO + url — для голосовых это не срабатывало.

Исправление

  • Определение голосовых: AUDIO, VOICE, UNSUPPORTED с token/duration/wave
  • Получение URL через WebSocket:
    • AUDIO_PLAY (opcode 301) по token/audioId
    • GET_FILE_URL (88) по token как fallback
  • Скачивание и отправка в Telegram как voice

Проверка на VPS

cd /opt/max2tg
sudo -u max2tg git fetch origin cursor/fix-audio-voice-ec4d
sudo -u max2tg git checkout cursor/fix-audio-voice-ec4d
sudo -u max2tg git pull
sudo systemctl restart max2tg

Попросите прислать голосовое — в Telegram должно прийти аудио, в логах:
Resolved audio URL via AUDIO_PLAY token

Open in Web Open in Cursor 

cursoragent and others added 4 commits June 15, 2026 13:59
Mute state in Max is stored in settings.chats, but on connect we only
loaded the chats array from AUTH_SNAPSHOT. Chats muted via «без звука»
were therefore unknown until a live NOTIF_CONFIG arrived.

- Load mute state from both chats[] and settings.chats on snapshot
- Raise chatsCount from 10 to 40 and request full sync params
- Handle alternate NOTIF_CHAT / NOTIF_CONFIG payload shapes
- Add integration tests for skip-muted filtering

Co-authored-by: eGoR <erop39@users.noreply.github.com>
AUTH_SNAPSHOT often does not include settings.chats with dontDisturbUntil.
NOTIF_CONFIG (134) only sends a config hash, not mute data.

- Request settings with opcode 22 using snapshot hash after connect
- Refresh mute state when NOTIF_CONFIG arrives
- Warn in logs when mute list is still empty after CONFIG fetch

Co-authored-by: eGoR <erop39@users.noreply.github.com>
When SKIP_MUTED=true, first-connect message includes:
«🔇 из них без звука: N»

Co-authored-by: eGoR <erop39@users.noreply.github.com>
Max voice notes use _type UNSUPPORTED or AUDIO with a token, not a
direct url. Resolve download URL via AUDIO_PLAY (301) or GET_FILE_URL
with token, then forward as Telegram voice.

Co-authored-by: eGoR <erop39@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants