dank074 / Discord-video-stream

Experiment for making video streaming work for discord selfbots.
180 stars 32 forks source link

implement audio reciever [beta] #61

Open kylerifqi opened 8 months ago

kylerifqi commented 8 months ago

i implemented the discord/voice code into the streamer. it can be used the same way discord/voice would be used, but not exactly the same. im not entirely sure this works as i have not done any extensive tests but it worked well for me.

i also added an example to show how to use the new reciever addition, but a tlrdr is that you basically use it by

const stream = streamer.voiceConnection.reciever.subscribe(USER_ID)
// do something with the OPUS stream

i added a set voice state fn that should not change how anything already written using this library will run:

Streamer.setVoiceState(guild_id, channel_id, { self_mute, self_deaf, self_video })
// to change mute, deafen, or video state
// note: any of self_mute, self_deaf and self_video, can be omitted and the last set state will be used.

my code editor formatted my files a little so it changed the position of the imports and removed some spaces and i dont really know how to make it not do that. it might be beneficial to add a linter like eslint or something since the files dont really have a uniform format and the tab and spaces do be coexisting with each other.

this is my first time making a PR so my bad if i messed anything up. please give feedback and i will change whatever necessary.

kylerifqi commented 8 months ago

this is by no means finished, i did make this implementation in a day so there may be a few bugs i havent noticed.