Validates audio file formats and MIME types for Telegram voice message compatibility. Use when processing audio uploads for messaging bots.
// Source: https://github.com/Bitterbot-AI/bitterbot-desktop | License: MIT | Copyright 2025-2026 Victor Michael Gil / Bitterbot AI
// Provided via justclaw.it.com; keep this notice with the code.
import { getFileExtension, normalizeMimeType } from "./mime.js";
export const TELEGRAM_VOICE_AUDIO_EXTENSIONS = new Set([".oga", ".ogg", ".opus", ".mp3", ".m4a"]);
/**
* MIME types compatible with voice messages.
* Telegram sendVoice supports OGG/Opus, MP3, and M4A.
* https://core.telegram.org/bots/api#sendvoice
*/
export const TELEGRAM_VOICE_MIME_TYPES = new Set([
"audio/ogg",
"audio/opus",
"audio/mpeg",
"audio/mp3",
"audio/mp4",
"audio/x-m4a",
"audio/m4a",
]);
export function isTelegramVoiceCompatibleAudio(opts: {
contentType?: string | null;
fileName?: string | null;
}
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key