aiko-chan-ai / Discord-video-selfbot

for djs-selfbot-v13
https://github.com/dank074/Discord-video-stream
33 stars 8 forks source link

new error #2

Closed Turkidev closed 1 year ago

Turkidev commented 1 year ago

Error starting stream: TypeError: this.client.removeListener is not a function at DiscordStreamClient.unpatch (file:///root/show_vc/node_modules/discord-stream-client/src/index.js:23:15) at DiscordStreamClient.patch (file:///root/show_vc/node_modules/discord-stream-client/src/index.js:19:8) at DiscordStreamClient.joinVoiceChannel (file:///root/show_vc/node_modules/discord-stream-client/src/index.js:86:8) at startStreaming (/root/show_vc/index.js:1400:72)

 `                    case 'stream':
                    async function startStreaming(client) {
                        const { DiscordStreamClient } = await import('discord-stream-client');
                        const streamClient = new DiscordStreamClient({ client });

                        const voiceChannel = message.member.voice.channel;
                        if (!voiceChannel) {
                            return message.channel.send('You need to join a voice channel first!');
                        }

                        const voiceConnection = await streamClient.joinVoiceChannel(voiceChannel, {
                            selfDeaf: false,
                            selfMute: false,
                            selfVideo: false,
                        });

                        const streamConnection = await voiceConnection.createStream();
                        message.channel.send(`Streaming started at ${voiceChannel}`);

                        if (this.client instanceof EventEmitter) {
                            setTimeout(() => {
                                this.client.removeListener('streamPause', pauseScreenShare);
                                streamClient.pauseScreenShare(true);
                            }, 5000);
                        } else {
                            console.error('Error: this.client is not an EventEmitter object');
                        }
                    }

                    startStreaming(client).catch((error) => {
                        console.error('Error starting stream:', error);
                    });
                    break;`
aiko-chan-ai commented 1 year ago

image :skull:

Turkidev commented 1 year ago

huh?

aiko-chan-ai commented 1 year ago

please look at my code again

aiko-chan-ai commented 1 year ago

image

Turkidev commented 1 year ago

its now joining the channel but after 5s it leave without starting the screen

` case 'stream': async function startStreaming() { const { DiscordStreamClient } = await import('discord-stream-client'); const StreamClient = new DiscordStreamClient(client);

                        const voiceChannel = message.member.voice.channel;
                        if (!voiceChannel) {
                            return message.channel.send('You need to join a voice channel first!');
                        }

                        const voiceConnection = await StreamClient.joinVoiceChannel(voiceChannel, {
                            selfDeaf: false,
                            selfMute: false,
                            selfVideo: false,
                        });

                        const streamConnection = await voiceConnection.createStream();

                        const player = StreamClient.createPlayer(
                            'https://dl2.issou.best/ordr/videos/render1046454.mp4', // DIRECT VIDEO URL OR READABLE STREAM HERE
                            streamConnection.udp, // UDP connection
                        );

                        player.play();

                        setTimeout(() => {
                            StreamClient.pauseScreenShare(true);
                        }, 30_000);

                        message.channel.send(`Streaming started at ${voiceChannel}`);
                    }

                    startStreaming().catch((error) => {
                        console.error('Error starting stream:', error);
                    });
                    break;`