MCPcopy Index your code
hub / github.com/b1naryth1ef/telecom

github.com/b1naryth1ef/telecom @v0.0.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.0.4 ↗ · + Follow
74 symbols 145 edges 11 files 11 documented · 15%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

telecom

Telecom is WIP and subject to lots of change. This document doesn't accurately represnt the current featureset of telecom during its development.

Telecom is a small Go library which implements the Discord voice protocol. Because of the way this protocol was designed telecom can live in an entirely isolated world and still be utilized by any common Discord library. Telecom shares some ideas with the lavalink project but has a focus on embedding and performance.

Supported Interfaces

  • Shared Library Telecom can be built as a shared library and integrated into any modern language that supports a standard C FFI interface. This provides a great opportunity for libraries to include telecom instead of reinventing the wheel of voice connections.
  • Python Library Telecom includes a Python library which generates a low-level Python C module and wraps it in a higher level pure-Python library.
  • HTTP Server Telecom also provides a binary that can be used to run an HTTP server with a simple JSON API. This can be utilized to distribute voice connections across multiple servers for large bots.

Language Wrappers

  • Python 2.7+/3.6+

Example

C FFI

client* client = create_client(user_id, guild_id, session_id)

client_set_server_info(client, endpoint, token)

playable* playable = create_playable_from_url("https://discordapp.com/tunes.mp3")
client_play(client, playable)

playable_pause(playable)
playable_stop(playable)

client_set_volume(client, 70)

playable* pipe = create_playable_from_pcm_pipe()
playable_pipe_send(pipe, my_pcm_data)

client_destroy(client)

Python

from telecom import Client, Playable, Output

client = Client(user_id, guild_id, session_id)

# Later when you've joined a voice channel and have received the `endpoint` and `token`...
client.set_server_info(endpoint, token)

# Create a playable and play it
song = Playable.from_url('https://discordapp.com/tunes.mp3')
client.play(song)

# Pause or stop the playable
song.pause()
song.stop()

# Adjust the volume of the client
client.set_volume(70)

# Perhaps we want to stream in some audio data from Python land
pipe = Playable.from_pcm_pipe()
pipe.send(my_pcm_frame)

# Save a single users audio data to a file
user = client.get_user(other_user_id)
output = Output.to_file('bob.mp3')
user.set_output(output)

# Mux everyones audio into a single stream and save it to a file
other_output = Output.to_file('everyone.mp3')
output_muxer = Output.muxer(include_self=False)
output_muxer.set_output(other_output)
client.set_output_muxer(output_muxer)

Extension points exported contracts — how you extend this code

Playable (Interface)
(no doc) [2 implementers]
playable.go

Core symbols most depended-on inside this repo

Close
called by 4
playable.go
SetSpeaking
called by 3
client.go
NewAvConvPlayable
called by 2
avconv.go
Output
called by 2
playable.go
NewClient
called by 2
client.go
Run
called by 2
client.go
Play
called by 2
client.go
telecom_setup_logging
called by 2
cmd/telecom-native/main.go

Shape

Method 33
Function 20
Struct 13
Class 7
Interface 1

Languages

Go64%
Python24%
C12%

Modules by API surface

client.go23 symbols
py/telecom.c9 symbols
cmd/telecom-native/main.go9 symbols
py/telecom/__init__.py8 symbols
playable.go8 symbols
avconv.go6 symbols
py/setup.py5 symbols
py/examples/disco_music.py5 symbols
cmd/telecom-client/main.go1 symbols

For agents

$ claude mcp add telecom \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact