inmotionfasad.blogg.se

Screen sharing discord bot
Screen sharing discord bot





screen sharing discord bot

stop” command, the “Video” button is clicked again, disabling it until the next video is ready to be played. Once the video is finished, or is interrupted by the “. This starts transmitting audio and video in the channel from two loopback devices, both of which are being written to by ffmpeg, using youtube-dl as the input.

screen sharing discord bot

When it’s time to start playing a video, the browser clicks the “Video” button. In this case, the browser opens to Discord’s web application, looks for a unique element selector belonging to the voice channel, then simulates a click event to join it. To actually stream the audio & video, I’m using Puppeteer – a library for programmatically controlling a browser. This is used to receive and handle command messages, then delete them to avoid cluttering the channel.

screen sharing discord bot

With that disclaimer out of the way, this bot is written in Node.js with the discord.js library – specifically an older v11.x version, since using a non-bot token on newer releases seems to always result in an ‘invalid token’ error. Most libraries should work the same whether you use a bot token or a regular user one but, fair warning, this is probably not a good idea. So, for this to work, we’re going to use a regular user account instead. It’s not all that efficient, reliable, or even terms-of-service-legal, but it was fun to build, and hopefully this post will inspire someone to make something better so I can switch to using that instead.Īs far as I could tell from skimming documentation and various libraries, Discord bots can transmit audio in voice channels, but can’t screen share or stream from a camera. I recently finished writing a Discord bot to play audio and video from YouTube, Twitch, and various other sources. Video streaming bot for Discord Test driving v4l2loopback and some basic browser automation.







Screen sharing discord bot