Skip to content

Releases: tusar404/ArcMusic

v1.0.0

25 Mar 22:54
08dc113

Choose a tag to compare

This commit introduces the seamless integration of ArcApi for rapid media downloading and implements several crucial quality-of-life improvements across the bot's core modules and deployment environment.

⚙️ Core Architecture & Library Stack:

  • Language & Concurrency: Built entirely in Go (Golang) to leverage lightweight goroutines for managing multiple concurrent voice chat streams without thread blocking.
  • Telegram Framework (MTProto): Utilizes the gogram library for bare-metal MTProto interactions. This powers both the main Bot token and the Assistant (Userbot) accounts, handling peer resolution and raw Telegram API requests.
  • Streaming Engine: Powered by NTGCalls (native C-bindings) for direct WebRTC injection into Telegram Voice Chats. Combined with FFmpeg pipelines, it allows zero-latency encoding of audio/video streams (e.g., dynamically adjusting sample rates to 96kHz and applying tempo filters for speed control).
  • Database: Uses the official go.mongodb.org/mongo-driver/v2 for persistent storage, caching, and state management.

🔄 ArcApi Integration & Working Mechanics:

  • Transitioned to a streamlined, high-speed API V2 polling architecture using ArcApi for media extraction and downloading.
  • Polling Engine (arcapi.go): Instead of relying purely on heavy local extraction, the bot sends an asynchronous request to the ArcApi backend. It then utilizes an exponential backoff loop to poll the /youtube/jobStatus endpoint.
  • Smart Routing: Once the API returns a candidate URL, the Go backend parses the JSON to determine the transport method. If it detects a direct CDN link, it downloads it via fast HTTP. If it detects a t.me/ link, it intercepts the message ID and downloads the file natively through Telegram's servers at maximum bandwidth, completely bypassing external network bottlenecks.
  • Dependency Fallback: If ArcApi misses, the bot falls back to yt-dlp via Go's os/exec module.

🛠 Module Optimizations & Code Fixes:

  • Assistant Cache Warming (chat_state.go): Fixed the "missing from cache" MTProto error for Supergroups (-100 IDs). The assistant now dynamically forces a peer resolution and silently recaches the group via invite links before attempting to bind the NTGCalls stream.
  • Reliable yt-dlp Updates: Modified install.sh and Dockerfile to forcefully upgrade yt-dlp using pip3 install -U yt-dlp --break-system-packages, ensuring the local fallback extractor never fails due to outdated Python binaries.
  • Accurate Active Tracking (active.go): Overhauled the /active command. Instead of counting potentially stale RoomState structs in memory, it directly queries the active NTGCalls map (a.Ntg.Calls()), providing a perfect 1:1 metric of live audio connections.
  • System Stats (ping.go): Integrated github.com/shirou/gopsutil to accurately fetch and calculate RAM and Disk usage as dynamic percentages instead of static gigabyte blocks.
  • Announcer Cleanup (voicechat.go): Removed the automatic "Voice chat started/ended" text broadcasts to reduce chat pollution and database read/writes on voice chat state changes.

Arc API maintained by Team Arc | Main Developer @tusar404

Full Changelog: https://github.com/tusar404/ArcMusic/commits/v1.0.0