From c540b2c3d64329ba3f9af29431cf174e7e21d222 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sat, 4 Jun 2016 03:16:47 +0200 Subject: [PATCH 1/6] Removed hide/unhide commands. Removed "Trivia cancelled" console message. Slight change to .newavatar --- .../Administration/AdministrationModule.cs | 6 +++-- .../Modules/Conversations/Conversations.cs | 22 ------------------- .../Games/Commands/Trivia/TriviaGame.cs | 6 +---- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/NadekoBot/Modules/Administration/AdministrationModule.cs b/NadekoBot/Modules/Administration/AdministrationModule.cs index eb2ae46d..8e0c6b16 100644 --- a/NadekoBot/Modules/Administration/AdministrationModule.cs +++ b/NadekoBot/Modules/Administration/AdministrationModule.cs @@ -720,11 +720,13 @@ namespace NadekoBot.Modules.Administration var avatarAddress = e.GetArg("img"); var imageStream = await SearchHelper.GetResponseStreamAsync(avatarAddress).ConfigureAwait(false); var image = System.Drawing.Image.FromStream(imageStream); - // Save the image to disk. - image.Save("data/avatar.png", System.Drawing.Imaging.ImageFormat.Png); await client.CurrentUser.Edit(NadekoBot.Creds.Password, avatar: image.ToStream()).ConfigureAwait(false); + // Send confirm. await e.Channel.SendMessage("New avatar set.").ConfigureAwait(false); + + // Save the image to disk. + image.Save("data/avatar.png", System.Drawing.Imaging.ImageFormat.Png); }); cgb.CreateCommand(Prefix + "setgame") diff --git a/NadekoBot/Modules/Conversations/Conversations.cs b/NadekoBot/Modules/Conversations/Conversations.cs index b8de0cea..a88841d9 100644 --- a/NadekoBot/Modules/Conversations/Conversations.cs +++ b/NadekoBot/Modules/Conversations/Conversations.cs @@ -258,28 +258,6 @@ namespace NadekoBot.Modules.Conversations await e.Channel.SendMessage("I can't find a message mentioning you.").ConfigureAwait(false); }); - cgb.CreateCommand("hide") - .Description("Hides Nadeko in plain sight!11!!") - .Do(async e => - { - using (var ms = Resources.hidden.ToStream(ImageFormat.Png)) - { - await client.CurrentUser.Edit(NadekoBot.Creds.Password, avatar: ms).ConfigureAwait(false); - } - await e.Channel.SendMessage("*hides*").ConfigureAwait(false); - }); - - cgb.CreateCommand("unhide") - .Description("Unhides Nadeko in plain sight!1!!1") - .Do(async e => - { - using (var fs = new FileStream("data/avatar.png", FileMode.Open)) - { - await client.CurrentUser.Edit(NadekoBot.Creds.Password, avatar: fs).ConfigureAwait(false); - } - await e.Channel.SendMessage("*unhides*").ConfigureAwait(false); - }); - cgb.CreateCommand("dump") .Description("Dumps all of the invites it can to dump.txt.** Owner Only.**") .Do(async e => diff --git a/NadekoBot/Modules/Games/Commands/Trivia/TriviaGame.cs b/NadekoBot/Modules/Games/Commands/Trivia/TriviaGame.cs index 0d90acce..683eb3d0 100644 --- a/NadekoBot/Modules/Games/Commands/Trivia/TriviaGame.cs +++ b/NadekoBot/Modules/Games/Commands/Trivia/TriviaGame.cs @@ -2,7 +2,6 @@ using Discord.Commands; using NadekoBot.Classes; using NadekoBot.Extensions; -using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; @@ -79,10 +78,7 @@ namespace NadekoBot.Modules.Games.Commands.Trivia await Task.Delay(QuestionDurationMiliseconds - HintTimeoutMiliseconds, token).ConfigureAwait(false); } - catch (TaskCanceledException) - { - Console.WriteLine("Trivia cancelled"); - } + catch (TaskCanceledException) { } //means someone guessed the answer GameActive = false; if (!triviaCancelSource.IsCancellationRequested) await channel.Send($":clock2: :question: **Time's up!** The correct answer was **{CurrentQuestion.Answer}**").ConfigureAwait(false); From 221d5d90287946ce34b835949f7f2d7f49d78f1b Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sat, 4 Jun 2016 07:45:20 +0200 Subject: [PATCH 2/6] .leave commands added --- .../Administration/AdministrationModule.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NadekoBot/Modules/Administration/AdministrationModule.cs b/NadekoBot/Modules/Administration/AdministrationModule.cs index 8e0c6b16..fc907cac 100644 --- a/NadekoBot/Modules/Administration/AdministrationModule.cs +++ b/NadekoBot/Modules/Administration/AdministrationModule.cs @@ -1000,6 +1000,21 @@ namespace NadekoBot.Modules.Administration await e.Channel.SendMessage("```xl\n" + string.Join("\n", arr.GroupBy(item => (i++) / 3).Select(ig => string.Join("", ig.Select(el => $"• {el,-35}")))) + "\n```"); }); + cgb.CreateCommand(Prefix + "leave") + .Description("Leaves a server with a supplied ID.\n**Usage**: `.leave 493243292839`") + .Parameter("num", ParameterType.Required) + .AddCheck(SimpleCheckers.OwnerOnly()) + .Do(async e => + { + var srvr = NadekoBot.Client.Servers.Where(s => s.Id.ToString() == e.GetArg("num").Trim()).FirstOrDefault(); + if (srvr == null) + { + return; + } + await srvr.Leave(); + await e.Channel.SendMessage("`Done.`"); + }); + }); } From d8f85910af0da3b809298ba7306c188c702a2505 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sat, 4 Jun 2016 16:54:11 +0200 Subject: [PATCH 3/6] return on error message... --- NadekoBot/Modules/Administration/Commands/AutoAssignRole.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/NadekoBot/Modules/Administration/Commands/AutoAssignRole.cs b/NadekoBot/Modules/Administration/Commands/AutoAssignRole.cs index 5894e340..c6a5ab9a 100644 --- a/NadekoBot/Modules/Administration/Commands/AutoAssignRole.cs +++ b/NadekoBot/Modules/Administration/Commands/AutoAssignRole.cs @@ -32,8 +32,8 @@ namespace NadekoBot.Modules.Administration.Commands internal override void Init(CommandGroupBuilder cgb) { - cgb.CreateCommand(Module.Prefix + "aar") - .Alias(Module.Prefix + "autoassignrole") + cgb.CreateCommand(Module.Prefix + "autoassignrole") + .Alias(Module.Prefix + "aar") .Description($"Automaticaly assigns a specified role to every user who joins the server. Type `.aar` to disable, `.aar Role Name` to enable") .Parameter("role", ParameterType.Unparsed) .AddCheck(new SimpleCheckers.ManageRoles()) @@ -42,6 +42,7 @@ namespace NadekoBot.Modules.Administration.Commands if (!e.Server.CurrentUser.ServerPermissions.ManageRoles) { await e.Channel.SendMessage("I do not have the permission to manage roles."); + return; } var r = e.GetArg("role")?.Trim(); From 46bfcb56b90d2dc22a471f30f643b2bdf45a6b6a Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Tue, 7 Jun 2016 01:03:41 +0200 Subject: [PATCH 4/6] trello fix? --- NadekoBot/Modules/Trello/TrelloModule.cs | 16 ++++++++-------- NadekoBot/_Models/JSONModels/Configuration.cs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/NadekoBot/Modules/Trello/TrelloModule.cs b/NadekoBot/Modules/Trello/TrelloModule.cs index 01d69ad0..ecba583d 100644 --- a/NadekoBot/Modules/Trello/TrelloModule.cs +++ b/NadekoBot/Modules/Trello/TrelloModule.cs @@ -63,13 +63,13 @@ namespace NadekoBot.Modules.Trello } }; - manager.CreateCommands("trello ", cgb => + manager.CreateCommands("", cgb => { cgb.AddCheck(PermissionChecker.Instance); - cgb.CreateCommand("join") - .Alias("j") + cgb.CreateCommand(Prefix + "join") + .Alias(Prefix + "j") .Description("Joins a server") .Parameter("code", Discord.Commands.ParameterType.Required) .Do(async e => @@ -86,7 +86,7 @@ namespace NadekoBot.Modules.Trello } }); - cgb.CreateCommand("bind") + cgb.CreateCommand(Prefix + "bind") .Description("Bind a trello bot to a single channel. " + "You will receive notifications from your board when something is added or edited." + "\n**Usage**: bind [board_id]") @@ -109,7 +109,7 @@ namespace NadekoBot.Modules.Trello } }); - cgb.CreateCommand("unbind") + cgb.CreateCommand(Prefix + "unbind") .Description("Unbinds a bot from the channel and board.") .Do(async e => { @@ -122,8 +122,8 @@ namespace NadekoBot.Modules.Trello }); - cgb.CreateCommand("lists") - .Alias("list") + cgb.CreateCommand(Prefix + "lists") + .Alias(Prefix + "list") .Description("Lists all lists yo ;)") .Do(async e => { @@ -133,7 +133,7 @@ namespace NadekoBot.Modules.Trello .ConfigureAwait(false); }); - cgb.CreateCommand("cards") + cgb.CreateCommand(Prefix + "cards") .Description("Lists all cards from the supplied list. You can supply either a name or an index.") .Parameter("list_name", Discord.Commands.ParameterType.Unparsed) .Do(async e => diff --git a/NadekoBot/_Models/JSONModels/Configuration.cs b/NadekoBot/_Models/JSONModels/Configuration.cs index 37312588..df601db0 100644 --- a/NadekoBot/_Models/JSONModels/Configuration.cs +++ b/NadekoBot/_Models/JSONModels/Configuration.cs @@ -142,7 +142,7 @@ namespace NadekoBot.Classes.JSONModels public string ClashOfClans { get; set; } = ","; public string Help { get; set; } = "-"; public string Music { get; set; } = "!m"; - public string Trello { get; set; } = "trello"; + public string Trello { get; set; } = "trello "; public string Games { get; set; } = ">"; public string Gambling { get; set; } = "$"; public string Permissions { get; set; } = ";"; From 84fe644db385372e970f081ba68cfcaa47063104 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sun, 12 Jun 2016 15:11:51 +0200 Subject: [PATCH 5/6] fixed typo --- .../Modules/Administration/Commands/SelfAssignedRolesCommand.cs | 2 +- NadekoBot/bin/Debug/data/config_example.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs b/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs index cf252994..e42aa270 100644 --- a/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs +++ b/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs @@ -67,7 +67,7 @@ namespace NadekoBot.Modules.Administration.Commands }); cgb.CreateCommand(Module.Prefix + "lsar") - .Description("Lits all self-assignable roles.") + .Description("Lists all self-assignable roles.") .Parameter("roles", ParameterType.Multiple) .Do(async e => { diff --git a/NadekoBot/bin/Debug/data/config_example.json b/NadekoBot/bin/Debug/data/config_example.json index 87fb3c50..4496c5ff 100644 --- a/NadekoBot/bin/Debug/data/config_example.json +++ b/NadekoBot/bin/Debug/data/config_example.json @@ -81,7 +81,7 @@ "ClashOfClans": ",", "Help": "-", "Music": "!m", - "Trello": "trello", + "Trello": "trello ", "Games": ">", "Gambling": "$", "Permissions": ";", From 3c74d1915ede8955e18258325f65a4037b2a844c Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Wed, 15 Jun 2016 13:42:36 +0200 Subject: [PATCH 6/6] removed some trash --- NadekoBot/Modules/Trello/TrelloModule.cs | 18 ------------------ NadekoBot/NadekoBot.cs | 15 --------------- 2 files changed, 33 deletions(-) diff --git a/NadekoBot/Modules/Trello/TrelloModule.cs b/NadekoBot/Modules/Trello/TrelloModule.cs index ecba583d..fc30deed 100644 --- a/NadekoBot/Modules/Trello/TrelloModule.cs +++ b/NadekoBot/Modules/Trello/TrelloModule.cs @@ -68,24 +68,6 @@ namespace NadekoBot.Modules.Trello cgb.AddCheck(PermissionChecker.Instance); - cgb.CreateCommand(Prefix + "join") - .Alias(Prefix + "j") - .Description("Joins a server") - .Parameter("code", Discord.Commands.ParameterType.Required) - .Do(async e => - { - if (!NadekoBot.IsOwner(e.User.Id) || NadekoBot.IsBot) return; - try - { - await (await client.GetInvite(e.GetArg("code")).ConfigureAwait(false)).Accept() - .ConfigureAwait(false); - } - catch (Exception ex) - { - Console.WriteLine(ex.ToString()); - } - }); - cgb.CreateCommand(Prefix + "bind") .Description("Bind a trello bot to a single channel. " + "You will receive notifications from your board when something is added or edited." + diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs index 1c9aea9d..88e3443d 100644 --- a/NadekoBot/NadekoBot.cs +++ b/NadekoBot/NadekoBot.cs @@ -48,21 +48,6 @@ namespace NadekoBot { Console.OutputEncoding = Encoding.Unicode; - //var lines = File.ReadAllLines("data/input.txt"); - //HashSet list = new HashSet(); - //for (int i = 0; i < lines.Length; i += 3) { - // dynamic obj = new JArray(); - // obj.Text = lines[i]; - // obj.Author = lines[i + 1]; - // if (obj.Author.StartsWith("-")) - // obj.Author = obj.Author.Substring(1, obj.Author.Length - 1).Trim(); - // list.Add(obj); - //} - - //File.WriteAllText("data/quotes.json", Newtonsoft.Json.JsonConvert.SerializeObject(list, Formatting.Indented)); - - //Console.ReadKey(); - // generate credentials example so people can know about the changes i make try { File.WriteAllText("data/config_example.json", JsonConvert.SerializeObject(new Configuration(), Formatting.Indented));