From 1d632b61d8bbdd62240ecc808ae4ce7705c7ded2 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sun, 10 Jan 2016 15:49:31 +0100 Subject: [PATCH] cleanup, added prune command --- NadekoBot/Classes/Trivia.cs | 1 + NadekoBot/Modules/Administration.cs | 16 +++++++++++++++- NadekoBot/Modules/Music.cs | 4 ++-- NadekoBot/NadekoBot.csproj | 27 ++++++++++++++++++++++----- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/NadekoBot/Classes/Trivia.cs b/NadekoBot/Classes/Trivia.cs index 25f6b238..21bc9815 100644 --- a/NadekoBot/Classes/Trivia.cs +++ b/NadekoBot/Classes/Trivia.cs @@ -140,6 +140,7 @@ namespace NadekoBot private async void PotentialGuess(object sender, MessageEventArgs e) { + if (e.Server == null || e.Channel == null) return; if (e.Server.Id != _serverId || !active) return; diff --git a/NadekoBot/Modules/Administration.cs b/NadekoBot/Modules/Administration.cs index 0ce38265..bf9a3f3b 100644 --- a/NadekoBot/Modules/Administration.cs +++ b/NadekoBot/Modules/Administration.cs @@ -274,8 +274,22 @@ namespace NadekoBot.Modules var time = (DateTime.Now - Process.GetCurrentProcess().StartTime); string uptime = " " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes."; - await e.Send( String.Format("```Servers: {0}\nUnique Users: {1}\nUptime: {2}\nMy id is: {3}```", serverCount, uniqueUserCount, uptime, client.CurrentUser.Id)); + await e.Send($"```Servers: {serverCount}\nUnique Users: {uniqueUserCount}\nUptime: {uptime}\nMy id is: {client.CurrentUser.Id}```"); }); + cgb.CreateCommand(".prune") + .Parameter("num", Discord.Commands.ParameterType.Required) + .Do(async e => { + int num; + + if (!Int32.TryParse(e.GetArg("num"), out num) || num < 1) { + await e.Send("Incorrect amount."); + return; + } + + (await e.Channel.DownloadMessages(num)).ForEach(async m => await m.Delete()); + + }); + }); } diff --git a/NadekoBot/Modules/Music.cs b/NadekoBot/Modules/Music.cs index 344bb358..6ba63884 100644 --- a/NadekoBot/Modules/Music.cs +++ b/NadekoBot/Modules/Music.cs @@ -111,7 +111,8 @@ namespace NadekoBot.Modules { if (video?.Uri != "" && video.Uri != null) { SongQueue.Add(video); - await e.Send("**Queued** " + video.FullName); + if(SongQueue.Count > 1) + await e.Send("**Queued** " + video.FullName); } }); @@ -171,7 +172,6 @@ namespace NadekoBot.Modules { var msg = await e.Send("Playing " + Music.CurrentSong.FullName + " [00:00]"); int counter = 0; int byteCount; - var m = await e.Send("Downloading song..."); while ((byteCount = streamer.PCMOutput.Read(buffer, 0, blockSize)) > 0) { Voice.Send(buffer, byteCount); diff --git a/NadekoBot/NadekoBot.csproj b/NadekoBot/NadekoBot.csproj index f5b9574b..39f7dcaf 100644 --- a/NadekoBot/NadekoBot.csproj +++ b/NadekoBot/NadekoBot.csproj @@ -12,20 +12,24 @@ v4.5.2 512 true - publish\ + true + C:\Users\Master\Desktop\NadekoBot\ true - Disk - false + Web + true Foreground 7 Days false false true - 0 + http://www.github.com/Kwoth/NadekoBot/ + true + publish.htm + 1 1.0.0.%2a - false false + true true @@ -47,6 +51,18 @@ prompt 4 + + 0BE5B9F3B97B52FC5776E3D046AE0C7F708D2ED5 + + + NadekoBot_TemporaryKey.pfx + + + true + + + true + ..\packages\VideoLibrary.1.3.1\lib\portable-net45+win+wpa81+MonoAndroid10+xamarinios10+MonoTouch10\libvideo.dll @@ -112,6 +128,7 @@ +