Beispiel #1
0
        public void Start()
        {
            Running = true;

            Task.Run(() =>
            {
                var voiceClient = _client.GetVoiceClient(_guildId);

                while (voiceClient.State == MediaConnectionState.Ready && Tracks.Count > 0)
                {
                    var currentSong = Tracks[0];

                    var manifest = Program.YouTubeClient.Videos.Streams.GetManifestAsync(currentSong.Id).Result;

                    if (_stream == null)
                    {
                        VoiceChannel currentChannel = (VoiceChannel)_client.GetChannel(voiceClient.Channel.Id);
                        _stream = DiscordVoiceUtils.GetAudioStream(GetVideoUrl(currentSong.Id, currentChannel.Bitrate));
                    }

                    if (voiceClient.Microphone.CopyFrom(_stream, currentSong.CancellationTokenSource.Token))
                    {
                        _stream = null;
                        Tracks.RemoveAt(0);
                    }
                    else if (currentSong.CancellationTokenSource.IsCancellationRequested)
                    {
                        _stream = null;
                    }
                }

                Running = false;
            });
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Config config = JsonConvert.DeserializeObject <Config>(File.ReadAllText("Config.json"));

            Audio     = DiscordVoiceUtils.ReadFromFile(config.AudioPath);
            Nicknames = config.Nicknames;

            foreach (var inv in File.ReadAllLines(config.InvitesPath))
            {
                AvailableGuilds.Enqueue(new GuildInfo(inv));
            }

            StartAssignerAsync();

            foreach (var token in File.ReadAllLines(config.TokensPath))
            {
                try
                {
                    new BroadcastClient(token);
                }
                catch (InvalidTokenException ex)
                {
                    Console.WriteLine($"{ex.Token} is invalid!");
                }
            }

            Thread.Sleep(-1);
        }
Beispiel #3
0
        public async Task StartAsync()
        {
            while (true)
            {
                if (Session.State == MediaSessionState.Authenticated && Tracks.Count > 0)
                {
                    MusicTrack currentTrack = Tracks[0];

                    if (currentTrack.DownloadTask != null)
                    {
                        await currentTrack.DownloadTask;
                    }

                    if (CurrentTrackStream == null)
                    {
                        CurrentTrackStream = DiscordVoiceUtils.GetAudioStream(currentTrack.FilePath);
                    }

                    try
                    {
                        SessionStream.CopyFrom(CurrentTrackStream);

                        Tracks.RemoveAt(0);
                        CurrentTrackStream.Flush();
                        CurrentTrackStream = null;
                    }
                    catch { }
                }
                else
                {
                    await Task.Delay(100);
                }
            }
        }
Beispiel #4
0
        public void StartQueue()
        {
            while (true)
            {
                if (_stop)
                {
                    return;
                }

                try
                {
                    var track = this.Queue.Dequeue();

                    CurrentTrack = track;

                    this.Client.Speak(DiscordVoiceUtils.ReadFromFile(track.File), 64 * 1024, AudioApplication.Music);

                    if (Loop)
                    {
                        _loopQueue.Add(track);
                    }
                }
                catch
                {
                    if (Loop && _loopQueue.Count > 0)
                    {
                        this.Queue = new Queue <Track>(_loopQueue);
                    }
                    else
                    {
                        Thread.Sleep(100);
                    }
                }
            }
        }
        public static void Client_OnLoggedIn(DiscordSocketClient client, LoginEventArgs args)
        {
            // This will be triggered upon successfull login.
            Console.WriteLine("Logged in!");

            // If you really wanted to you could just change these values to some guildID and channelID.
            // However then if you were to use this exploit in another discord server.
            // You would have to recompile each time so ive made it like this where its gonna ask for the ID's.
            ulong guildID   = 0;
            ulong channelID = 0;

            // File extensions that ive tested and that are working | mp3, wav, mp4 and probably others.
            // No mp4 doesn't crash anything even tho its a video its just gonna play the audio only so its still gonna work.
            Console.WriteLine(@"Input sound path example: C:\Users\Manono\Downloads\sound.mp3");

            Console.Write("Enter your song path: ");
            // This will store the filepath to the sound in a string that afterwards gets called.
            // You could also set this over the source like guildID and channelID but you would have to recompile to change sound.
            string soundLocation = Console.ReadLine();

            Console.WriteLine(string.Empty);

            Console.Write("Enter guildID: ");
            // Just stores guildID into a string variable that gets called afterwards in the exploit.
            guildID = Convert.ToUInt64(Console.ReadLine());
            Console.WriteLine(string.Empty);

            Console.Write("Enter channelID: ");
            // Just stores channelID into a string variable that gets called afterwards in the exploit.
            channelID = Convert.ToUInt64(Console.ReadLine());
            Console.WriteLine(string.Empty);

            // This will get the sound from the sound location that the user typed in.
            byte[] sound = DiscordVoiceUtils.ReadFromFile(soundLocation);

            // This will start the exploit making the account join a voice channel depending on the guildID and channelID.
            // the true and false is the fun part of this whole exploit thing.
            // If you were to set muted to true (the first bool option) then the bot will join with the muted icon however it will still play the sound.
            // Same goes for the second bool option which is deafened if thats true the bot will join while deafened and still play the sound.
            // So if you were to troll people in a big voice call you could just turn both of these to true.
            // That would make the bot join the voice channel while being both muted and deafened but it would still play the sounds so you could earrape the voice call.
            var session = client.JoinVoiceChannel(guildID, channelID, true, false);

            session.OnConnected += (s, a) =>
            {
                Console.WriteLine("Speaking");
                // This will start the sound playing once the account joins the voice chat.
                var stream = session.CreateStream(64000);

                // This is also somewhat funny if you change Soundshare to Microphone its gonna show that you speak with the green circle.
                // If its not speaking its just not gonna speak at all
                // And if its on Soundshare its gonna use discord's screenshare option to output audio so that you wont have a green circle when speaking.
                // This is fun to do in voice calls with friends as you can just make the bot account join unmuted and undeafened but with Soundshare sound
                // So it won't show a green circle but still earrape your friends etc.
                session.SetSpeakingState(DiscordVoiceSpeakingState.Soundshare);
            };
        }
Beispiel #6
0
        private static void Client_OnJoinedVoiceChannel(DiscordSocketClient client, VoiceConnectEventArgs args)
        {
            Console.WriteLine(client.User.ToString() + " has joined " + args.Client.Channel.Id);

            // exploit that lets you speak while muted (https://www.youtube.com/watch?v=PWzPa_BIv9s)
            args.Client.Microphone.Bitrate = ((VoiceChannel)client.GetChannel(args.Client.Channel.Id)).Bitrate;
            args.Client.Microphone.SetSpeakingState(DiscordSpeakingFlags.Soundshare);

            CancellationTokenSource source = new CancellationTokenSource();

            Task.Run(() =>
            {
                while (true)
                {
                    if (GetParticipantCount(client, args.Client.Channel.Id) == 0)
                    {
                        source.Cancel();
                        if (Connect(client))
                        {
                            Console.WriteLine(client.User.ToString() + " is switching channel, due to there being noone in the current one");
                        }
                        else
                        {
                            args.Client.Disconnect();
                        }

                        return;
                    }

                    Thread.Sleep(100);
                }
            });

            while (args.Client.State == MediaConnectionState.Ready && !source.IsCancellationRequested)
            {
                args.Client.Microphone.CopyFrom(DiscordVoiceUtils.GetAudioStream(AudioPath), source.Token);
            }
        }
Beispiel #7
0
        public void StartQueue()
        {
            while (true)
            {
                if (_stop)
                {
                    return;
                }

                try
                {
                    var track = this.Queue.Dequeue();

                    CurrentTrack = track;

                    byte[]             file   = DiscordVoiceUtils.ReadFromFile(track.File);
                    int                offset = 0;
                    DiscordVoiceStream stream = Session.CreateStream(64 * 1024, AudioApplication.Music);

                    while (offset < file.Length)
                    {
                        if (Paused)
                        {
                            Thread.Sleep(100);
                        }
                        else
                        {
                            try
                            {
                                offset = stream.Write(file, offset);
                            }
                            catch
                            {
                                if (SwitchingChannels)
                                {
                                    Thread.Sleep(100);
                                }
                                else
                                {
                                    return;
                                }
                            }
                        }
                    }

                    if (Loop)
                    {
                        _loopQueue.Add(track);
                    }
                }
                catch
                {
                    if (Loop && _loopQueue.Count > 0)
                    {
                        this.Queue = new Queue <Track>(_loopQueue);
                    }
                    else
                    {
                        Thread.Sleep(100);
                    }
                }
            }
        }