fix a few minor things in the bot

This commit is contained in:
zontreck 2021-02-21 05:37:25 -07:00
parent 18a4fc0186
commit 95d661ada2
5 changed files with 66 additions and 5 deletions

View file

@ -7,7 +7,7 @@ using LibZNI;
[assembly: AssemblyCompany("ZNI")]
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
[assembly: AssemblyCopyright("(C) 2020 Tara Piccari")]
[assembly: AssemblyFileVersion("5.0.7.9119")]
[assembly: AssemblyFileVersion("5.0.7.9200")]
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
[assembly: AutoUpdater("/job/Bot", "!os!.tar")]
@ -16,7 +16,7 @@ namespace Bot.Assemble
public class ASMInfo
{
public static string BotName = "ZBotCore";
public static string BotVer = "5.0.7.9119";
public static string BotVer = "5.0.7.9200";
public static string GitPassword
{
get

View file

@ -109,7 +109,7 @@ namespace Bot.CommandSystem
if (Cmds.ContainsKey(CG.Command) == false)
{
Log.info(true, "DISCOVER: " + CG.Command);
Cmds.Add(CG.Command, CG);
Cmds.Add(CG.Command.ToLower(), CG);
}
}
}
@ -199,9 +199,9 @@ namespace Bot.CommandSystem
string[] cmdStruct = cmdString.Split(' ');
string commandLabel = cmdStruct[0];
if (Cmds.ContainsKey(commandLabel))
if (Cmds.ContainsKey(commandLabel.ToLower()))
{
CommandGroup cg = Cmds[commandLabel];
CommandGroup cg = Cmds[commandLabel.ToLower()];
if(level >= cg.minLevel)
{
Destinations dst = cg.CommandSource;

View file

@ -81,6 +81,12 @@ namespace Bot
public List<string> DisabledCommands { get; set; } = new List<string>();
/// <summary>
/// This is a list of groups that will be ignored by the Bot's NonCommand system. Meaning, no chat log, and no auto responses. Bot Commands will work as normal.
/// </summary>
public List<UUID> IgnoreGroups { get; set; } = new List<UUID>();
public bool Authed(string GHLogin)
{
if (AuthedGithubUsers.Contains(GHLogin)) return true;

View file

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Bot;
using Bot.CommandSystem;
using OpenMetaverse;
namespace BotCore5.NonCommands
{
public class IgnoreNonCommands : BaseCommands
{
[CommandGroup("ignorethisgroup", 5, "ignorethisgroup - Ignores the group this command was issued in", Destinations.DEST_GROUP)]
public void ignoreMe(UUID client, int level, string[] additionalArgs,
Destinations source,
UUID agentKey, string agentName)
{
// Check the main config for this value already being there
// If it is not there, add it. Otherwise give the error and dont modify it
if (MainConfiguration.Instance.IgnoreGroups.Contains(client))
{
MHE(source, client, "ERROR: This group is already being ignored for non-commands.");
}
else
{
MainConfiguration.Instance.IgnoreGroups.Add(client);
MainConfiguration.Instance.Save();
MHE(source, client, "Success. Any message that is not a command will now be ignored by all bot operations in this group");
}
}
[CommandGroup("unignorethisgroup", 5, "unignorethisgroup - Ignores the group this command was issued in", Destinations.DEST_GROUP)]
public void UnignoreMe(UUID client, int level, string[] additionalArgs,
Destinations source,
UUID agentKey, string agentName)
{
if (MainConfiguration.Instance.IgnoreGroups.Contains(client))
{
MainConfiguration.Instance.IgnoreGroups.Remove(client);
MainConfiguration.Instance.Save();
MHE(source, client, "Success. The bot will no longer ignore non-commands from this group, such as auto responses.");
}
else
{
MHE(source, client, "ERROR: This group was not being ignored");
}
}
}
}

View file

@ -12,6 +12,10 @@ namespace Bot.NonCommands
{
public static void Dispatch(string request, UUID agentKey, string agentName, Destinations sourceLoc, UUID originator)
{
if (MainConfiguration.Instance.IgnoreGroups.Contains(originator))
{
return;
}
foreach(Assembly a in AppDomain.CurrentDomain.GetAssemblies())
{