From aa86359ea08fabc9b45ed3f263e6bf61851346ad Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Fri, 19 Feb 2016 04:53:54 +0100 Subject: [PATCH] ffmpeg won't log anymore --- NadekoBot/Classes/Music/StreamRequest.cs | 5 +--- NadekoBot/NadekoBot.cs | 30 ++++++++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/NadekoBot/Classes/Music/StreamRequest.cs b/NadekoBot/Classes/Music/StreamRequest.cs index ce0673d8..d02a0443 100644 --- a/NadekoBot/Classes/Music/StreamRequest.cs +++ b/NadekoBot/Classes/Music/StreamRequest.cs @@ -172,12 +172,9 @@ namespace NadekoBot.Classes.Music { //start feeding the buffer var p = Process.Start(new ProcessStartInfo { FileName = "ffmpeg", - Arguments = $"-i {Url} -f s16le -ar 48000 -ac 2 pipe:1", + Arguments = $"-i {Url} -f s16le -ar 48000 -ac 2 pipe:1 -loglevel quiet", //+ (NadekoBot.IsLinux ? "2> /dev/null" : "2>NUL"), UseShellExecute = false, RedirectStandardOutput = true, - RedirectStandardError = false, - CreateNoWindow = true, - WindowStyle = ProcessWindowStyle.Hidden, }); int attempt = 0; while (true) { diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index 7e5a3af0..9c5cda83 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -30,13 +30,15 @@ namespace NadekoBot { botMention = creds.BotMention; if (string.IsNullOrWhiteSpace(creds.GoogleAPIKey)) { Console.WriteLine("No google api key found. You will not be able to use music and links won't be shortened."); - } else { + } + else { Console.WriteLine("Google API key provided."); GoogleAPIKey = creds.GoogleAPIKey; } if (string.IsNullOrWhiteSpace(creds.TrelloAppKey)) { Console.WriteLine("No trello appkey found. You will not be able to use trello commands."); - } else { + } + else { Console.WriteLine("Trello app key provided."); TrelloAppKey = creds.TrelloAppKey; loadTrello = true; @@ -47,14 +49,15 @@ namespace NadekoBot { ForwardMessages = true; Console.WriteLine("Forwarding messages."); } - if(string.IsNullOrWhiteSpace(creds.SoundCloudClientID)) + if (string.IsNullOrWhiteSpace(creds.SoundCloudClientID)) Console.WriteLine("No soundcloud Client ID found. Soundcloud streaming is disabled."); else Console.WriteLine("SoundCloud streaming enabled."); OwnerID = creds.OwnerID; password = creds.Password; - } catch (Exception ex) { + } + catch (Exception ex) { Console.WriteLine($"Failed to load stuff from credentials.json, RTFM\n{ex.Message}"); Console.ReadKey(); return; @@ -70,9 +73,9 @@ namespace NadekoBot { var commandService = new CommandService(new CommandServiceConfigBuilder { AllowMentionPrefix = false, CustomPrefixHandler = m => 0, - HelpMode = HelpMode.Disabled + HelpMode = HelpMode.Disabled, }); - + //reply to personal messages and forward if enabled. client.MessageReceived += Client_MessageReceived; @@ -83,7 +86,7 @@ namespace NadekoBot { var modules = client.AddService(new ModuleService()); //add audio service - var audio = client.AddService(new AudioService(new AudioServiceConfigBuilder() { + var audio = client.AddService(new AudioService(new AudioServiceConfigBuilder() { Channels = 2, EnableEncryption = false, EnableMultiserver = true, @@ -121,14 +124,14 @@ namespace NadekoBot { try { OwnerPrivateChannel = await client.CreatePrivateChannel(OwnerID); - } catch { + } + catch { Console.WriteLine("Failed creating private channel with the owner"); } Classes.Permissions.PermissionsHandler.Initialize(); - client.ClientAPI.SendingRequest += (s, e) => - { + client.ClientAPI.SendingRequest += (s, e) => { var request = e.Request as Discord.API.Client.Rest.SendMessageRequest; if (request != null) { if (string.IsNullOrWhiteSpace(request.Content)) @@ -139,12 +142,12 @@ namespace NadekoBot { }); Console.WriteLine("Exiting..."); Console.ReadKey(); - } + } static bool repliedRecently = false; private static async void Client_MessageReceived(object sender, MessageEventArgs e) { if (e.Server != null || e.User.Id == client.CurrentUser.Id) return; - if (PollCommand.ActivePolls.SelectMany(kvp => kvp.Key.Users.Select(u=>u.Id)).Contains(e.User.Id)) return; + if (PollCommand.ActivePolls.SelectMany(kvp => kvp.Key.Users.Select(u => u.Id)).Contains(e.User.Id)) return; // just ban this trash AutoModerator // and cancer christmass spirit // and crappy shotaslave @@ -157,7 +160,8 @@ namespace NadekoBot { await (await client.GetInvite(e.Message.Text)).Accept(); await e.Send("I got in!"); return; - } catch { + } + catch { if (e.User.Id == 109338686889476096) { //carbonitex invite await e.Send("Failed to join the server."); return;