From 1feddabce13b83ec41f9fc05da9fed8f1014a07e Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sat, 18 Jun 2016 00:02:03 +0200 Subject: [PATCH] Better help, better organization of aliases and commands names, a lot of commandnames changed. --- .../Administration/AdministrationModule.cs | 86 +++++++------------ .../Commands/CustomReactionsCommands.cs | 6 +- .../Administration/Commands/InfoCommands.cs | 12 +-- .../Commands/SelfAssignedRolesCommand.cs | 4 +- .../Commands/VoicePlusTextCommand.cs | 5 +- NadekoBot/Modules/Help/HelpModule.cs | 7 +- NadekoBot/Modules/Searches/SearchesModule.cs | 30 ++++++- 7 files changed, 80 insertions(+), 70 deletions(-) diff --git a/NadekoBot/Modules/Administration/AdministrationModule.cs b/NadekoBot/Modules/Administration/AdministrationModule.cs index 445f8bf1..e3e8bdf1 100644 --- a/NadekoBot/Modules/Administration/AdministrationModule.cs +++ b/NadekoBot/Modules/Administration/AdministrationModule.cs @@ -56,7 +56,7 @@ namespace NadekoBot.Modules.Administration Environment.Exit(0); }); - cgb.CreateCommand(Prefix + "sr").Alias(Prefix + "setrole") + cgb.CreateCommand(Prefix + "setrole").Alias(Prefix + "sr") .Description("Sets a role for a given user.\n**Usage**: .sr @User Guest") .Parameter("user_name", ParameterType.Required) .Parameter("role_name", ParameterType.Unparsed) @@ -99,7 +99,7 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "rr").Alias(Prefix + "removerole") + cgb.CreateCommand(Prefix + "removerole").Alias(Prefix + "rr") .Description("Removes a role from a given user.\n**Usage**: .rr @User Admin") .Parameter("user_name", ParameterType.Required) .Parameter("role_name", ParameterType.Unparsed) @@ -136,8 +136,8 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "renr") - .Alias(Prefix + "renamerole") + cgb.CreateCommand(Prefix + "renamerole") + .Alias(Prefix + "renr") .Description($"Renames a role. Role you are renaming must be lower than bot's highest role.\n**Usage**: `{Prefix}renr \"First role\" SecondRole`") .Parameter("r1", ParameterType.Required) .Parameter("r2", ParameterType.Required) @@ -170,7 +170,7 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "rar").Alias(Prefix + "removeallroles") + cgb.CreateCommand(Prefix + "removeallroles").Alias(Prefix + "rar") .Description("Removes all roles from a mentioned user.\n**Usage**: .rar @User") .Parameter("user_name", ParameterType.Unparsed) .AddCheck(SimpleCheckers.CanManageRoles) @@ -196,7 +196,7 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "r").Alias(Prefix + "role").Alias(Prefix + "cr") + cgb.CreateCommand(Prefix + "createrole").Alias(Prefix + "cr") .Description("Creates a role with a given name.**Usage**: `.r Awesome Role`") .Parameter("role_name", ParameterType.Unparsed) .AddCheck(SimpleCheckers.CanManageRoles) @@ -278,7 +278,7 @@ namespace NadekoBot.Modules.Administration await e.Channel.SendMessage("`List of roles:` \n• " + string.Join("\n• ", e.Server.Roles)).ConfigureAwait(false); }); - cgb.CreateCommand(Prefix + "b").Alias(Prefix + "ban") + cgb.CreateCommand(Prefix + "ban").Alias(Prefix + "b") .Parameter("user", ParameterType.Required) .Parameter("msg", ParameterType.Optional) .Description("Bans a user by id or name with an optional message.\n**Usage**: .b \"@some Guy\" Your behaviour is toxic.") @@ -313,7 +313,7 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "sb").Alias(Prefix + "softban") + cgb.CreateCommand(Prefix + "softban").Alias(Prefix + "sb") .Parameter("user", ParameterType.Required) .Parameter("msg", ParameterType.Optional) .Description("Bans and then unbans a user by id or name with an optional message.\n**Usage**: .sb \"@some Guy\" Your behaviour is toxic.") @@ -349,7 +349,7 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "k").Alias(Prefix + "kick") + cgb.CreateCommand(Prefix + "kick").Alias(Prefix + "k") .Parameter("user") .Parameter("msg", ParameterType.Unparsed) .Description("Kicks a mentioned user.") @@ -462,7 +462,7 @@ namespace NadekoBot.Modules.Administration }); cgb.CreateCommand(Prefix + "undeafen") - .Alias(Prefix + "undeaf") + .Alias(Prefix + "undef") .Description("Undeafens mentioned user or users") .Parameter("throwaway", ParameterType.Unparsed) .Do(async e => @@ -488,8 +488,9 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "rvch") - .Description("Removes a voice channel with a given name.") + cgb.CreateCommand(Prefix + "delvoichanl") + .Alias(Prefix + "dvch") + .Description("Deletes a voice channel with a given name.") .Parameter("channel_name", ParameterType.Required) .Do(async e => { @@ -510,7 +511,8 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "vch").Alias(Prefix + "cvch") + cgb.CreateCommand(Prefix + "creatvoichanl") + .Alias(Prefix + "cvch") .Description("Creates a new voice channel with a given name.") .Parameter("channel_name", ParameterType.Required) .Do(async e => @@ -529,8 +531,9 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "rch").Alias(Prefix + "rtch") - .Description("Removes a text channel with a given name.") + cgb.CreateCommand(Prefix + "deltxtchanl") + .Alias(Prefix + "dtch") + .Description("Deletes a text channel with a given name.") .Parameter("channel_name", ParameterType.Required) .Do(async e => { @@ -550,7 +553,8 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "ch").Alias(Prefix + "tch") + cgb.CreateCommand(Prefix + "creatxtchanl") + .Alias(Prefix + "ctch") .Description("Creates a new text channel with a given name.") .Parameter("channel_name", ParameterType.Required) .Do(async e => @@ -569,8 +573,8 @@ namespace NadekoBot.Modules.Administration } }); - cgb.CreateCommand(Prefix + "st").Alias(Prefix + "settopic") - .Alias(Prefix + "topic") + cgb.CreateCommand(Prefix + "settopic") + .Alias(Prefix + "st") .Description($"Sets a topic on the current channel.\n**Usage**: `{Prefix}st My new topic`") .AddCheck(SimpleCheckers.ManageChannels()) .Parameter("topic", ParameterType.Unparsed) @@ -581,8 +585,8 @@ namespace NadekoBot.Modules.Administration await e.Channel.SendMessage(":ok: **New channel topic set.**").ConfigureAwait(false); }); - cgb.CreateCommand(Prefix + "schn").Alias(Prefix + "setchannelname") - .Alias(Prefix + "topic") + cgb.CreateCommand(Prefix + "setchanlname") + .Alias(Prefix + "schn") .Description("Changed the name of the current channel.") .AddCheck(SimpleCheckers.ManageChannels()) .Parameter("name", ParameterType.Unparsed) @@ -595,7 +599,7 @@ namespace NadekoBot.Modules.Administration await e.Channel.SendMessage(":ok: **New channel name set.**").ConfigureAwait(false); }); - cgb.CreateCommand(Prefix + "uid").Alias(Prefix + "userid") + cgb.CreateCommand(Prefix + "userid").Alias(Prefix + "uid") .Description("Shows user ID.") .Parameter("user", ParameterType.Unparsed) .Do(async e => @@ -607,11 +611,11 @@ namespace NadekoBot.Modules.Administration await e.Channel.SendMessage($"Id of the user { usr.Name } is { usr.Id }").ConfigureAwait(false); }); - cgb.CreateCommand(Prefix + "cid").Alias(Prefix + "channelid") + cgb.CreateCommand(Prefix + "channelid").Alias(Prefix + "cid") .Description("Shows current channel ID.") .Do(async e => await e.Channel.SendMessage("This channel's ID is " + e.Channel.Id).ConfigureAwait(false)); - cgb.CreateCommand(Prefix + "sid").Alias(Prefix + "serverid") + cgb.CreateCommand(Prefix + "serverid").Alias(Prefix + "sid") .Description("Shows current server ID.") .Do(async e => await e.Channel.SendMessage("This server's ID is " + e.Server.Id).ConfigureAwait(false)); @@ -639,7 +643,7 @@ namespace NadekoBot.Modules.Administration }); cgb.CreateCommand(Prefix + "prune") - .Alias(".clr") + .Alias(Prefix + "clr") .Description( "`.prune` removes all nadeko's messages in the last 100 messages.`.prune X` removes last X messages from the channel (up to 100)`.prune @Someone` removes all Someone's messages in the last 100 messages.`.prune @Someone X` removes last X 'Someone's' messages in the channel.\n**Usage**: `.prune` or `.prune 5` or `.prune @Someone` or `.prune @Someone X`") .Parameter("user_or_num", ParameterType.Optional) @@ -709,7 +713,6 @@ namespace NadekoBot.Modules.Administration }); cgb.CreateCommand(Prefix + "die") - .Alias(Prefix + "graceful") .Description("Shuts the bot down and notifies users about the restart. **Bot Owner Only!**") .AddCheck(SimpleCheckers.OwnerOnly()) .Do(async e => @@ -719,8 +722,8 @@ namespace NadekoBot.Modules.Administration Environment.Exit(0); }); - cgb.CreateCommand(Prefix + "newname") - .Alias(Prefix + "setname") + cgb.CreateCommand(Prefix + "setname") + .Alias(Prefix + "newnm") .Description("Give the bot a new name. **Bot Owner Only!**") .Parameter("new_name", ParameterType.Unparsed) .AddCheck(SimpleCheckers.OwnerOnly()) @@ -839,8 +842,8 @@ namespace NadekoBot.Modules.Administration await e.Channel.SendMessage("Failed. Make sure you've specified server and [channel or user]").ConfigureAwait(false); }); - cgb.CreateCommand(Prefix + "menrole") - .Alias(Prefix + "mentionrole") + cgb.CreateCommand(Prefix + "mentionrole") + .Alias(Prefix + "menro") .Description("Mentions every person from the provided role or roles (separated by a ',') on this server. Requires you to have mention everyone permission.") .Parameter("roles", ParameterType.Unparsed) .Do(async e => @@ -924,8 +927,7 @@ namespace NadekoBot.Modules.Administration }).ConfigureAwait(false); }); - cgb.CreateCommand(Prefix + "adddon") - .Alias(Prefix + "donadd") + cgb.CreateCommand(Prefix + "donadd") .Description("Add a donator to the database.") .Parameter("donator") .Parameter("amount") @@ -951,28 +953,6 @@ namespace NadekoBot.Modules.Administration }).ConfigureAwait(false); }); - cgb.CreateCommand(Prefix + "videocall") - .Description("Creates a private video call link for you and other mentioned people. The link is sent to mentioned people via a private message.") - .Parameter("arg", ParameterType.Unparsed) - .Do(async e => - { - try - { - var allUsrs = e.Message.MentionedUsers.Union(new User[] { e.User }); - var allUsrsArray = allUsrs as User[] ?? allUsrs.ToArray(); - var str = allUsrsArray.Aggregate("http://appear.in/", (current, usr) => current + Uri.EscapeUriString(usr.Name[0].ToString())); - str += new Random().Next(); - foreach (var usr in allUsrsArray) - { - await usr.SendMessage(str).ConfigureAwait(false); - } - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - }); - cgb.CreateCommand(Prefix + "announce") .Description($"Sends a message to all servers' general channel bot is connected to.**Bot Owner Only!**\n**Usage**: {Prefix}announce Useless spam") .Parameter("msg", ParameterType.Unparsed) diff --git a/NadekoBot/Modules/Administration/Commands/CustomReactionsCommands.cs b/NadekoBot/Modules/Administration/Commands/CustomReactionsCommands.cs index 81f9ab40..3809df90 100644 --- a/NadekoBot/Modules/Administration/Commands/CustomReactionsCommands.cs +++ b/NadekoBot/Modules/Administration/Commands/CustomReactionsCommands.cs @@ -19,7 +19,7 @@ namespace NadekoBot.Modules.Administration.Commands { var Prefix = Module.Prefix; - cgb.CreateCommand(Prefix + "addcustomreaction") + cgb.CreateCommand(Prefix + "addcustreact") .Alias(Prefix + "acr") .Description($"Add a custom reaction. Guide here: **Bot Owner Only!** \n**Usage**: {Prefix}acr \"hello\" I love saying hello to %user%") .AddCheck(SimpleCheckers.OwnerOnly()) @@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Administration.Commands }); - cgb.CreateCommand(Prefix + "listcustomreactions") + cgb.CreateCommand(Prefix + "listcustreact") .Alias(Prefix + "lcr") .Description($"Lists all current custom reactions (paginated with 5 commands per page).\n**Usage**:{Prefix}lcr 1") .Parameter("num", ParameterType.Required) @@ -55,7 +55,7 @@ namespace NadekoBot.Modules.Administration.Commands await e.Channel.SendMessage(result).ConfigureAwait(false); }); - cgb.CreateCommand(Prefix + "deletecustomreaction") + cgb.CreateCommand(Prefix + "delcustreact") .Alias(Prefix + "dcr") .Description("Deletes a custom reaction with given name (and index)") .Parameter("name", ParameterType.Required) diff --git a/NadekoBot/Modules/Administration/Commands/InfoCommands.cs b/NadekoBot/Modules/Administration/Commands/InfoCommands.cs index 9d6770ea..6d661285 100644 --- a/NadekoBot/Modules/Administration/Commands/InfoCommands.cs +++ b/NadekoBot/Modules/Administration/Commands/InfoCommands.cs @@ -16,8 +16,8 @@ namespace NadekoBot.Modules.Administration.Commands internal override void Init(CommandGroupBuilder cgb) { - cgb.CreateCommand(Module.Prefix + "sinfo") - .Alias(Module.Prefix + "serverinfo") + cgb.CreateCommand(Module.Prefix + "serverinfo") + .Alias(Module.Prefix + "sinfo") .Description($"Shows info about the server the bot is on. If no channel is supplied, it defaults to current one.\n**Usage**:{Module.Prefix}sinfo Some Server") .Parameter("server", ParameterType.Optional) .Do(async e => @@ -47,8 +47,8 @@ namespace NadekoBot.Modules.Administration.Commands await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false); }); - cgb.CreateCommand(Module.Prefix + "cinfo") - .Alias(Module.Prefix + "channelinfo") + cgb.CreateCommand(Module.Prefix + "channelinfo") + .Alias(Module.Prefix + "cinfo") .Description($"Shows info about the channel. If no channel is supplied, it defaults to current one.\n**Usage**:{Module.Prefix}cinfo #some-channel") .Parameter("channel", ParameterType.Optional) .Do(async e => @@ -69,8 +69,8 @@ namespace NadekoBot.Modules.Administration.Commands await e.Channel.SendMessage(sb.ToString()).ConfigureAwait(false); }); - cgb.CreateCommand(Module.Prefix + "uinfo") - .Alias(Module.Prefix + "userinfo") + cgb.CreateCommand(Module.Prefix + "userinfo") + .Alias(Module.Prefix + "uinfo") .Description($"Shows info about the user. If no user is supplied, it defaults a user running the command.\n**Usage**:{Module.Prefix}uinfo @SomeUser") .Parameter("user", ParameterType.Optional) .Do(async e => diff --git a/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs b/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs index 6b87b55f..eaf59a3a 100644 --- a/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs +++ b/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs @@ -139,8 +139,8 @@ namespace NadekoBot.Modules.Administration.Commands catch { } }); - cgb.CreateCommand(Module.Prefix + "iamn") - .Alias(Module.Prefix + "iamnot") + cgb.CreateCommand(Module.Prefix + "iamnot") + .Alias(Module.Prefix + "iamn") .Description("Removes a role to you that you choose. " + "Role must be on a list of self-assignable roles." + "\n**Usage**: .iamn Gamer") diff --git a/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs b/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs index 44419682..e307c796 100644 --- a/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs +++ b/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommand.cs @@ -87,6 +87,7 @@ namespace NadekoBot.Modules.Administration.Commands internal override void Init(CommandGroupBuilder cgb) { cgb.CreateCommand(Module.Prefix + "cleanv+t") + .Alias(Module.Prefix + "cv+t") .Description("Deletes all text channels ending in `-voice` for which voicechannels are not found. **Use at your own risk.**") .AddCheck(SimpleCheckers.CanManageRoles) .AddCheck(SimpleCheckers.ManageChannels()) @@ -116,8 +117,8 @@ namespace NadekoBot.Modules.Administration.Commands await e.Channel.SendMessage("`Done.`"); }); - cgb.CreateCommand(Module.Prefix + "v+t") - .Alias(Module.Prefix + "voice+text") + cgb.CreateCommand(Module.Prefix + "voice+text") + .Alias(Module.Prefix + "v+t") .Description("Creates a text channel for each voice channel only users in that voice channel can see." + "If you are server owner, keep in mind you will see them all the time regardless.") .AddCheck(SimpleCheckers.ManageChannels()) diff --git a/NadekoBot/Modules/Help/HelpModule.cs b/NadekoBot/Modules/Help/HelpModule.cs index fc19b28f..7612ef9b 100644 --- a/NadekoBot/Modules/Help/HelpModule.cs +++ b/NadekoBot/Modules/Help/HelpModule.cs @@ -50,7 +50,12 @@ namespace NadekoBot.Modules.Help return; } var i = 0; - await e.Channel.SendMessage("`List Of Commands:`\n```xl\n" + string.Join("\n", cmdsArray.GroupBy(item => (i++) / 3).Select(ig => string.Join("", ig.Select(el => $"{el.Text,-22}")))) + $"\n``` `You can type \"{Prefix}h command_name\" to see the help about that specific command.`").ConfigureAwait(false); + await e.Channel.SendMessage("`List Of Commands:`\n```xl\n" + + string.Join("\n", cmdsArray.GroupBy(item => (i++) / 3) + .Select(ig => string.Join("", ig.Select(el => $"{el.Text,-15}" + $"{"[" + el.Aliases.FirstOrDefault() + "]",-8}")))) + + $"\n```") + .ConfigureAwait(false); + await e.Channel.SendMessage($"`You can type \"{Prefix}h command_name\" to see the help about that specific command.`").ConfigureAwait(false); }); }); } diff --git a/NadekoBot/Modules/Searches/SearchesModule.cs b/NadekoBot/Modules/Searches/SearchesModule.cs index a614bd82..48e1c809 100644 --- a/NadekoBot/Modules/Searches/SearchesModule.cs +++ b/NadekoBot/Modules/Searches/SearchesModule.cs @@ -1,4 +1,5 @@ -using Discord.Commands; +using Discord; +using Discord.Commands; using Discord.Modules; using NadekoBot.Classes; using NadekoBot.Classes.JSONModels; @@ -27,7 +28,7 @@ namespace NadekoBot.Modules.Searches commands.Add(new StreamNotifications(this)); commands.Add(new ConverterCommand(this)); commands.Add(new RedditCommand(this)); - commands.Add(new WowJokeCommand(this)); + commands.Add(new WowJokeCommand(this)); commands.Add(new CalcCommand(this)); commands.Add(new WowJokeCommand(this)); rng = new Random(); @@ -472,7 +473,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】 var red = Convert.ToInt32(arg1.Substring(0, 2), 16); var green = Convert.ToInt32(arg1.Substring(2, 2), 16); var blue = Convert.ToInt32(arg1.Substring(4, 2), 16); - var brush = new SolidBrush(Color.FromArgb(red, green, blue)); + var brush = new SolidBrush(System.Drawing.Color.FromArgb(red, green, blue)); using (Graphics g = Graphics.FromImage(img)) { @@ -482,6 +483,29 @@ $@"🌍 **Weather for** 【{obj["target"]}】 await e.Channel.SendFile("arg1.png", img.ToStream()); }); + + + cgb.CreateCommand(Prefix + "videocall") + .Description("Creates a private video call link for you and other mentioned people. The link is sent to mentioned people via a private message.") + .Parameter("arg", ParameterType.Unparsed) + .Do(async e => + { + try + { + var allUsrs = e.Message.MentionedUsers.Union(new User[] { e.User }); + var allUsrsArray = allUsrs as User[] ?? allUsrs.ToArray(); + var str = allUsrsArray.Aggregate("http://appear.in/", (current, usr) => current + Uri.EscapeUriString(usr.Name[0].ToString())); + str += new Random().Next(); + foreach (var usr in allUsrsArray) + { + await usr.SendMessage(str).ConfigureAwait(false); + } + } + catch (Exception ex) + { + Console.WriteLine(ex); + } + }); }); } }