From 41e16c131886657e99864abd037dd5d1b70ec2af Mon Sep 17 00:00:00 2001 From: Tikuf Date: Sat, 25 Apr 2020 20:21:27 -0600 Subject: [PATCH 1/4] Better Help command --- Core/Commands/Self/Help.cs | 34 +++++++++++++++++++++++++++++----- Core/Commands/Self/sit.cs | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/Core/Commands/Self/Help.cs b/Core/Commands/Self/Help.cs index 0935628..db6557f 100644 --- a/Core/Commands/Self/Help.cs +++ b/Core/Commands/Self/Help.cs @@ -6,14 +6,38 @@ using OpenMetaverse; namespace BSB.Commands.Self -{ +{ public class Help : CoreCommand { - - public override string Helpfile { get { return "Makes the bot turn to face [ARG 1] and point at them (if found)"; } } + + public override string Helpfile { get { return "A Full list of supported commands"; } } public override bool CallFunction(string[] args) { - if (UUID.TryParse(bot.FindAvatarName2Key(bot.OwnerName), out UUID owner) == true) + if (bot.getMaster_uuid != UUID.Zero) + { + + StringBuilder sb = new StringBuilder(); + sb.Append(bot.GetCommandsInterface.GetCommandHelp("IM")); + sb.Append(bot.GetCommandsInterface.GetCommandHelp("SAY")); + sb.Append(bot.GetCommandsInterface.GetCommandHelp("BOTSIT")); + sb.Append("Type: 'morehelp' for a full list of commands"); + bot.sendIM(bot.getMaster_uuid, sb.ToString()); + + return true; + } + else + { + return Failed("UUID is not vaild"); + } + } + } + public class MoreHelp : CoreCommand + { + + public override string Helpfile { get { return "A Full list of supported commands"; } } + public override bool CallFunction(string[] args) + { + if (bot.getMaster_uuid != UUID.Zero) { string reply = ""; int counter = 0; @@ -35,7 +59,7 @@ namespace BSB.Commands.Self } } - bot.sendIM(owner, reply); + bot.sendIM(bot.getMaster_uuid, reply); return true; } diff --git a/Core/Commands/Self/sit.cs b/Core/Commands/Self/sit.cs index a82fc6c..515b161 100644 --- a/Core/Commands/Self/sit.cs +++ b/Core/Commands/Self/sit.cs @@ -11,7 +11,7 @@ namespace BSB.Commands.Self { public override string[] ArgTypes { get { return new[] { "Mixed" }; } } public override string[] ArgHints { get { return new[] { "Text \"ground\" or a object UUID" }; } } - public override string Helpfile { get { return "Makes the bot sit on the ground or on a object if it can see it"; } } + public override string Helpfile { get { return "Makes the bot sit on the ground or on a object if it can see it BOTSIT|||"+UUID.Zero; } } public override int MinArgs { get { return 1; } } public override bool CallFunction(string[] args) { From 38faaeeb80aea7e0506fcbc450182b96fbb008ae Mon Sep 17 00:00:00 2001 From: Tikuf Date: Sat, 25 Apr 2020 20:27:17 -0600 Subject: [PATCH 2/4] Fixed help file commands --- Core/Commands/Self/Help.cs | 6 +++--- README.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/Commands/Self/Help.cs b/Core/Commands/Self/Help.cs index db6557f..2b8d099 100644 --- a/Core/Commands/Self/Help.cs +++ b/Core/Commands/Self/Help.cs @@ -17,9 +17,9 @@ namespace BSB.Commands.Self { StringBuilder sb = new StringBuilder(); - sb.Append(bot.GetCommandsInterface.GetCommandHelp("IM")); - sb.Append(bot.GetCommandsInterface.GetCommandHelp("SAY")); - sb.Append(bot.GetCommandsInterface.GetCommandHelp("BOTSIT")); + sb.Append(bot.GetCommandsInterface.GetCommandHelp("Im")); + sb.Append(bot.GetCommandsInterface.GetCommandHelp("Say")); + sb.Append(bot.GetCommandsInterface.GetCommandHelp("BotSit")); sb.Append("Type: 'morehelp' for a full list of commands"); bot.sendIM(bot.getMaster_uuid, sb.ToString()); diff --git a/README.md b/README.md index bfc85e9..e9d627d 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,4 @@ Status Docker --------------- -[![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/madpeter/secondbot-bitbucket-auto?style=flat-square)](https://hub.docker.com/repository/docker/madpeter/secondbot-bitbucket-auto) +(Linux): [DockerHub](https://hub.docker.com/r/madpeter/secondbot-bitbucket-auto) From 298872acc821764f86a30cde1047a2cbd23e3fca Mon Sep 17 00:00:00 2001 From: Tikuf Date: Sat, 25 Apr 2020 20:52:06 -0600 Subject: [PATCH 3/4] Expanded help file --- Core/Commands/Chat/say.cs | 2 +- Core/Commands/Self/Help.cs | 14 +++++++++----- Core/Commands/Self/sit.cs | 2 +- Core/bottypes/DiscordBot.cs | 6 +++++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Core/Commands/Chat/say.cs b/Core/Commands/Chat/say.cs index af210e7..efa4bbb 100644 --- a/Core/Commands/Chat/say.cs +++ b/Core/Commands/Chat/say.cs @@ -10,7 +10,7 @@ namespace BSB.Commands.Chat { public override string[] ArgTypes { get { return new[] { "Mixed","Text" }; } } public override string[] ArgHints { get { return new[] { "Message or channel","Message" }; } } - public override string Helpfile { get { return "Makes the bot talk via chat
Example: say|||Hello
Example: say|||12~#~Goodbye"; } } + public override string Helpfile { get { return "Makes the bot talk via chat
Example: say|||Hello
Example: say|||12~#~Goodbye"; } } public override int MinArgs { get { return 1; } } public override bool CallFunction(string[] args) { diff --git a/Core/Commands/Self/Help.cs b/Core/Commands/Self/Help.cs index 2b8d099..7badadc 100644 --- a/Core/Commands/Self/Help.cs +++ b/Core/Commands/Self/Help.cs @@ -10,17 +10,21 @@ namespace BSB.Commands.Self public class Help : CoreCommand { - public override string Helpfile { get { return "A Full list of supported commands"; } } + public override string Helpfile { get { return "Basic list of commands"; } } public override bool CallFunction(string[] args) { if (bot.getMaster_uuid != UUID.Zero) { StringBuilder sb = new StringBuilder(); - sb.Append(bot.GetCommandsInterface.GetCommandHelp("Im")); - sb.Append(bot.GetCommandsInterface.GetCommandHelp("Say")); - sb.Append(bot.GetCommandsInterface.GetCommandHelp("BotSit")); - sb.Append("Type: 'morehelp' for a full list of commands"); + sb.Append(bot.GetCommandsInterface.GetCommandHelp("im")); + sb.Append("\n\n"); + sb.Append(bot.GetCommandsInterface.GetCommandHelp("say")); + sb.Append("\n\n"); + sb.Append(bot.GetCommandsInterface.GetCommandHelp("botsit")); + sb.Append("\n\n"); + sb.Append("\nType: 'morehelp' for a full list of commands"); + sb.Replace("
", "\n"); bot.sendIM(bot.getMaster_uuid, sb.ToString()); return true; diff --git a/Core/Commands/Self/sit.cs b/Core/Commands/Self/sit.cs index 515b161..2533d91 100644 --- a/Core/Commands/Self/sit.cs +++ b/Core/Commands/Self/sit.cs @@ -11,7 +11,7 @@ namespace BSB.Commands.Self { public override string[] ArgTypes { get { return new[] { "Mixed" }; } } public override string[] ArgHints { get { return new[] { "Text \"ground\" or a object UUID" }; } } - public override string Helpfile { get { return "Makes the bot sit on the ground or on a object if it can see it BOTSIT|||"+UUID.Zero; } } + public override string Helpfile { get { return "Makes the bot sit on the ground or on a object if it can see it
Example: BOTSIT|||" + UUID.Zero; } } public override int MinArgs { get { return 1; } } public override bool CallFunction(string[] args) { diff --git a/Core/bottypes/DiscordBot.cs b/Core/bottypes/DiscordBot.cs index 11a5bba..709459a 100644 --- a/Core/bottypes/DiscordBot.cs +++ b/Core/bottypes/DiscordBot.cs @@ -239,7 +239,11 @@ namespace BSB.bottypes public override void KillMePlease() { base.KillMePlease(); - _ = DiscordKillMePlease(); + if(DiscordClient != null) + { + _ = DiscordKillMePlease(); + } + } protected void DiscordGetNewChannelProperies(TextChannelProperties C,string channelname,string channeltopic,string catname) From 9869e1c875822fd6616fd9d35876cdfca97189f1 Mon Sep 17 00:00:00 2001 From: Tikuf Date: Sat, 25 Apr 2020 20:58:16 -0600 Subject: [PATCH 4/4] Fixed readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e9d627d..bfc85e9 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,4 @@ Status Docker --------------- -(Linux): [DockerHub](https://hub.docker.com/r/madpeter/secondbot-bitbucket-auto) +[![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/madpeter/secondbot-bitbucket-auto?style=flat-square)](https://hub.docker.com/repository/docker/madpeter/secondbot-bitbucket-auto)