Make a few minor changes to allow discord commands to execute
This commit is contained in:
parent
6531716382
commit
43146d733d
4 changed files with 23 additions and 9 deletions
|
@ -5,8 +5,8 @@ using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyCompany("ZNI")]
|
[assembly: AssemblyCompany("ZNI")]
|
||||||
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
|
[assembly: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
|
||||||
[assembly: AssemblyCopyright("<EFBFBD> 2020 Tara Piccari")]
|
[assembly: AssemblyCopyright("(C) 2020 Tara Piccari")]
|
||||||
[assembly: AssemblyFileVersion("5.3.916")]
|
[assembly: AssemblyFileVersion("5.3.921")]
|
||||||
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
|
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace Bot.Assemble
|
||||||
public class ASMInfo
|
public class ASMInfo
|
||||||
{
|
{
|
||||||
public static string BotName = "ZBotCore";
|
public static string BotName = "ZBotCore";
|
||||||
public static string BotVer = "5.3.916";
|
public static string BotVer = "5.3.921";
|
||||||
public static string GitPassword
|
public static string GitPassword
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace Bot.CommandSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[CommandGroup("terminate_bot", 5, 0, "", Destinations.DEST_LOCAL | Destinations.DEST_AGENT | Destinations.DEST_DISCORD)]
|
[CommandGroup("terminate_bot", 5, 0, "", Destinations.DEST_LOCAL | Destinations.DEST_AGENT | Destinations.DEST_DISCORD | Destinations.DEST_GROUP)]
|
||||||
public void PerformExit(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName)
|
public void PerformExit(UUID client, int level, string[] additionalArgs, Destinations source, UUID agentKey, string agentName)
|
||||||
{
|
{
|
||||||
MHE(source, client, "Bot exit initiated.");
|
MHE(source, client, "Bot exit initiated.");
|
||||||
|
|
|
@ -219,6 +219,7 @@ namespace Bot.CommandSystem
|
||||||
if ((dests & Destinations.DEST_AGENT) == source) Allowed = true;
|
if ((dests & Destinations.DEST_AGENT) == source) Allowed = true;
|
||||||
if ((dests & Destinations.DEST_GROUP) == source) Allowed = true;
|
if ((dests & Destinations.DEST_GROUP) == source) Allowed = true;
|
||||||
if ((dests & Destinations.DEST_LOCAL) == source) Allowed = true;
|
if ((dests & Destinations.DEST_LOCAL) == source) Allowed = true;
|
||||||
|
if ((dests & Destinations.DEST_DISCORD) == source) Allowed = true;
|
||||||
|
|
||||||
if (!Allowed)
|
if (!Allowed)
|
||||||
{
|
{
|
||||||
|
@ -248,7 +249,8 @@ namespace Bot.CommandSystem
|
||||||
cgX.AssignedMethod.Invoke(ovj, new object[] { user,level,additionalArgs, source,agentKey, agentName });
|
cgX.AssignedMethod.Invoke(ovj, new object[] { user,level,additionalArgs, source,agentKey, agentName });
|
||||||
}catch(Exception e)
|
}catch(Exception e)
|
||||||
{
|
{
|
||||||
MessageFactory.Post(Destinations.DEST_LOCAL, "Exception caught when executing a command\n" + e.Message + "\nStacktrace: " + e.StackTrace, UUID.Zero);
|
BotSession.Instance.grid.Self.Chat("Exception caught when executing a command\n" + e.Message + "\nStacktrace: " + e.StackTrace, 0, ChatType.Shout);
|
||||||
|
//MessageFactory.Post(Destinations.DEST_LOCAL, "Exception caught when executing a command\n" + e.Message + "\nStacktrace: " + e.StackTrace, UUID.Zero);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
CMDThread.Start();
|
CMDThread.Start();
|
||||||
|
|
|
@ -113,13 +113,24 @@ namespace Bot
|
||||||
GroupID = ID;
|
GroupID = ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class DiscordMiscDataPacket
|
||||||
|
{
|
||||||
|
public ulong ServerID;
|
||||||
|
public ulong ChannelID;
|
||||||
|
public bool originateFromDiscord { get; set; } = false;
|
||||||
|
public string DiscordUserName;
|
||||||
|
public ulong DiscordMessageID;
|
||||||
|
}
|
||||||
public class DiscordMessage : Message
|
public class DiscordMessage : Message
|
||||||
{
|
{
|
||||||
private string Msg;
|
private string Msg;
|
||||||
public string ServerName;
|
public string ServerName;
|
||||||
public string ChannelName;
|
public string ChannelName;
|
||||||
private UUID SenderID;
|
private UUID SenderID;
|
||||||
|
/// <summary>
|
||||||
|
/// This is used to store misc data that could be identifying to where the data should go
|
||||||
|
/// </summary>
|
||||||
|
public DiscordMiscDataPacket PKT;
|
||||||
|
|
||||||
public override int GetChannel()
|
public override int GetChannel()
|
||||||
{
|
{
|
||||||
|
@ -166,12 +177,13 @@ namespace Bot
|
||||||
SenderID = Sender;
|
SenderID = Sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiscordMessage(string Msg, string Server, string Channel, UUID Sender)
|
public DiscordMessage(string Msg, string Server, string Channel, UUID Sender,DiscordMiscDataPacket pkt)
|
||||||
{
|
{
|
||||||
this.Msg = Msg;
|
this.Msg = Msg;
|
||||||
ServerName = Server;
|
ServerName = Server;
|
||||||
ChannelName = Channel;
|
ChannelName = Channel;
|
||||||
SenderID = Sender;
|
SenderID = Sender;
|
||||||
|
PKT = pkt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +191,7 @@ namespace Bot
|
||||||
public class MessageFactory
|
public class MessageFactory
|
||||||
{
|
{
|
||||||
|
|
||||||
public static void Post(Destinations dest, string Msg, UUID destID, int chn = 0,string ServerName="MAP_NOT_KNOWN", string ChannelName="MAP_NOT_KNOWN")
|
public static void Post(Destinations dest, string Msg, UUID destID, int chn = 0,string ServerName="MAP_NOT_KNOWN", string ChannelName="MAP_NOT_KNOWN",DiscordMiscDataPacket packet=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
Message m = null;
|
Message m = null;
|
||||||
|
@ -190,7 +202,7 @@ namespace Bot
|
||||||
m = new GroupMessage(destID);
|
m = new GroupMessage(destID);
|
||||||
break;
|
break;
|
||||||
case Destinations.DEST_DISCORD:
|
case Destinations.DEST_DISCORD:
|
||||||
m = new DiscordMessage(Msg,ServerName, ChannelName,destID);
|
m = new DiscordMessage(Msg,ServerName, ChannelName,destID,packet);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m = new ChatMessage(destID);
|
m = new ChatMessage(destID);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue