private async void Start(string Token, ulong UserId, int Delay, bool savepicsnvids, bool savemessages, bool delete, bool IsGroupChat) { await Task.Run(async() => { try { Random rnd = new Random(); Status.SafeChangeText("Starting"); DiscordClient client = new DiscordClient(Token); Logs.SafeAddItem(string.Format("Logged In To: {0}", client.User.Username)); if (!IsGroupChat) { var User = await client.GetUserAsync(UserId); var channelid = await client.CreateDMAsync(UserId); Logs.SafeAddItem(string.Format("Created Dms With: {0}", User.Username)); var msg = await client.GetChannelMessagesAsync(channelid.Id); Status.SafeChangeText("In Progress...."); var Convo = "SavedConvos/" + User.Username + rnd.Next(1, 999999999) + ".txt"; foreach (DiscordMessage message in msg) { if (savemessages) { using (StreamWriter writetext = new StreamWriter(Convo, true)) { writetext.WriteLine(message.Author.User.Username + " || " + message.Content); } } if (savepicsnvids) { if (message.Attachment != null) { if (message.Attachment.FileName.Contains(".mp4") || message.Attachment.FileName.Contains(".jpg") || message.Attachment.FileName.Contains(".png") || message.Attachment.FileName.Contains(".webm") || message.Attachment.FileName.Contains(".png") || message.Attachment.FileName.Contains(".gif")) { var webClient = new WebClient(); webClient.DownloadFileCompleted += (sender, e) => Logs.SafeAddItem(string.Format("Saved Image/Video: {0}", message.Attachment.FileName));; webClient.DownloadFileAsync(new Uri(message.Attachment.Url), "SavedMedia/" + message.Attachment.FileName); } } } if (delete) { if (message.Author.User.Id == client.User.Id) { if (message.Type != MessageType.Call && message.Type != MessageType.ChannelIconChange && message.Type != MessageType.ChannelNameChange && message.Type != MessageType.GuildMemberJoin && message.Type != MessageType.ChannelPinnedMessage && message.Type != MessageType.RecipientRemove && message.Type != MessageType.RecipientAdd) { await message.DeleteAsync(); Logs.SafeAddItem(string.Format("Deleted Message: {0}", message.Content)); await Task.Delay(Delay); } } } } Status.SafeChangeText("Completed"); } else if (IsGroupChat) { var GroupChat = await client.GetChannelAsync(UserId); Logs.SafeAddItem(string.Format("Hooked Group With Name: {0}", GroupChat.Name)); var msg = await client.GetChannelMessagesAsync(GroupChat.Id); Status.SafeChangeText("In Progress...."); var Convo = "SavedConvos/" + GroupChat.Name + rnd.Next(1, 999999999) + ".txt"; foreach (DiscordMessage message in msg) { if (savemessages) { using (StreamWriter writetext = new StreamWriter(Convo, true)) { writetext.WriteLine(message.Author.User.Username + " || " + message.Content); } } if (savepicsnvids) { if (message.Attachment != null) { if (message.Attachment.FileName.Contains(".mp4") || message.Attachment.FileName.Contains(".jpg") || message.Attachment.FileName.Contains(".png") || message.Attachment.FileName.Contains(".webm") || message.Attachment.FileName.Contains(".png") || message.Attachment.FileName.Contains(".gif")) { var webClient = new WebClient(); webClient.DownloadFileCompleted += (sender, e) => Logs.SafeAddItem(string.Format("Saved Image/Video: {0}", message.Attachment.FileName));; webClient.DownloadFileAsync(new Uri(message.Attachment.Url), "SavedMedia/" + message.Attachment.FileName); } } } if (delete) { if (message.Author.User.Id == client.User.Id) { if (message.Type != MessageType.Call && message.Type != MessageType.ChannelIconChange && message.Type != MessageType.ChannelNameChange && message.Type != MessageType.GuildMemberJoin && message.Type != MessageType.ChannelPinnedMessage && message.Type != MessageType.RecipientRemove && message.Type != MessageType.RecipientAdd) { await message.DeleteAsync(); Logs.SafeAddItem(string.Format("Deleted Message: {0}", message.Content)); await Task.Delay(Delay); } } } } Status.SafeChangeText("Completed"); } } catch (Exception ex) { //debug stuff Logs.SafeAddItem(string.Format("Error Message: {0}", ex.Message)); await Task.Delay(Delay); } }); }
private async void StartFriendFlood(int ThreadsAmount, ulong UserId) { await Task.Run(() => { Status.SafeChangeText(string.Format("{0} of {1} Friend Requests", Index, Accounts.Count)); List <Task> Threads = new List <Task>(); for (int i = 0; i < ThreadsAmount; i++) { Threads.Add(ThreadFriendFlood(UserId)); } Task.WaitAll(Threads.ToArray()); Status.SafeChangeText("Completed Friend Flood"); }); }