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: AssemblyAlgorithmId(System.Configuration.Assemblies.AssemblyHashAlgorithm.MD5)]
|
||||
[assembly: AssemblyCopyright("<EFBFBD> 2020 Tara Piccari")]
|
||||
[assembly: AssemblyFileVersion("5.3.916")]
|
||||
[assembly: AssemblyCopyright("(C) 2020 Tara Piccari")]
|
||||
[assembly: AssemblyFileVersion("5.3.921")]
|
||||
[assembly: AssemblyDescription("Second Life Bot - BotCore5")]
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace Bot.Assemble
|
|||
public class ASMInfo
|
||||
{
|
||||
public static string BotName = "ZBotCore";
|
||||
public static string BotVer = "5.3.916";
|
||||
public static string BotVer = "5.3.921";
|
||||
public static string GitPassword
|
||||
{
|
||||
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)
|
||||
{
|
||||
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_GROUP) == source) Allowed = true;
|
||||
if ((dests & Destinations.DEST_LOCAL) == source) Allowed = true;
|
||||
if ((dests & Destinations.DEST_DISCORD) == source) Allowed = true;
|
||||
|
||||
if (!Allowed)
|
||||
{
|
||||
|
@ -248,7 +249,8 @@ namespace Bot.CommandSystem
|
|||
cgX.AssignedMethod.Invoke(ovj, new object[] { user,level,additionalArgs, source,agentKey, agentName });
|
||||
}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();
|
||||
|
|
|
@ -113,13 +113,24 @@ namespace Bot
|
|||
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
|
||||
{
|
||||
private string Msg;
|
||||
public string ServerName;
|
||||
public string ChannelName;
|
||||
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()
|
||||
{
|
||||
|
@ -166,12 +177,13 @@ namespace Bot
|
|||
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;
|
||||
ServerName = Server;
|
||||
ChannelName = Channel;
|
||||
SenderID = Sender;
|
||||
PKT = pkt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,7 +191,7 @@ namespace Bot
|
|||
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;
|
||||
|
@ -190,7 +202,7 @@ namespace Bot
|
|||
m = new GroupMessage(destID);
|
||||
break;
|
||||
case Destinations.DEST_DISCORD:
|
||||
m = new DiscordMessage(Msg,ServerName, ChannelName,destID);
|
||||
m = new DiscordMessage(Msg,ServerName, ChannelName,destID,packet);
|
||||
break;
|
||||
default:
|
||||
m = new ChatMessage(destID);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue