Add a source type to not command hooks

This commit is contained in:
Zontreck 2020-06-02 08:32:33 -07:00
parent a50237304d
commit fe628b0a9d
3 changed files with 23 additions and 7 deletions

View file

@ -24,14 +24,26 @@ namespace Bot.NonCommands
NotCommand[] nc = (NotCommand[])mi.GetCustomAttributes(typeof(NotCommand), false);
if (nc.Length>0)
{
ThreadStart work = delegate
bool OK = false;
foreach(NotCommand nx in nc)
{
if (nx.SourceType.HasFlag(sourceLoc))
{
OK = true;
}
}
if (OK)
{
ThreadStart work = delegate
{
mi.Invoke(Activator.CreateInstance(mi.DeclaringType), new object[] { request, agentKey, agentName, sourceLoc, originator });
};
Thread T = new Thread(work);
T.Start();
mi.Invoke(Activator.CreateInstance(mi.DeclaringType), new object[] { request, agentKey, agentName, sourceLoc, originator });
};
Thread T = new Thread(work);
T.Start();
}
}
}