diff --git a/NadekoBot/Modules/Administration/AdministrationModule.cs b/NadekoBot/Modules/Administration/AdministrationModule.cs index 101c32b2..57a68dc6 100644 --- a/NadekoBot/Modules/Administration/AdministrationModule.cs +++ b/NadekoBot/Modules/Administration/AdministrationModule.cs @@ -722,11 +722,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") @@ -1000,6 +1002,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.`"); + }); + }); } 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(); 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/Modules/Conversations/Conversations.cs b/NadekoBot/Modules/Conversations/Conversations.cs index 7f7d3cb0..64f28376 100644 --- a/NadekoBot/Modules/Conversations/Conversations.cs +++ b/NadekoBot/Modules/Conversations/Conversations.cs @@ -262,28 +262,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); diff --git a/NadekoBot/Modules/Trello/TrelloModule.cs b/NadekoBot/Modules/Trello/TrelloModule.cs index 01d69ad0..fc30deed 100644 --- a/NadekoBot/Modules/Trello/TrelloModule.cs +++ b/NadekoBot/Modules/Trello/TrelloModule.cs @@ -63,30 +63,12 @@ namespace NadekoBot.Modules.Trello } }; - manager.CreateCommands("trello ", cgb => + manager.CreateCommands("", cgb => { cgb.AddCheck(PermissionChecker.Instance); - cgb.CreateCommand("join") - .Alias("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("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 +91,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 +104,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 +115,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/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)); diff --git a/NadekoBot/_Models/JSONModels/Configuration.cs b/NadekoBot/_Models/JSONModels/Configuration.cs index d48819b8..313fc1b8 100644 --- a/NadekoBot/_Models/JSONModels/Configuration.cs +++ b/NadekoBot/_Models/JSONModels/Configuration.cs @@ -147,7 +147,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; } = ";"; diff --git a/NadekoBot/bin/Debug/data/config_example.json b/NadekoBot/bin/Debug/data/config_example.json index 80c4bdfc..bf23699d 100644 --- a/NadekoBot/bin/Debug/data/config_example.json +++ b/NadekoBot/bin/Debug/data/config_example.json @@ -84,7 +84,7 @@ "ClashOfClans": ",", "Help": "-", "Music": "!m", - "Trello": "trello", + "Trello": "trello ", "Games": ">", "Gambling": "$", "Permissions": ";",