diff --git a/app/Console/Commands/PacketProcess.php b/app/Console/Commands/PacketProcess.php index e2da1fe..e57eeb4 100644 --- a/app/Console/Commands/PacketProcess.php +++ b/app/Console/Commands/PacketProcess.php @@ -16,7 +16,10 @@ class PacketProcess extends Command * * @var string */ - protected $signature = 'packet:process {pkt : Packet to process} {zone? : Zone the packet is from}'; + protected $signature = 'packet:process' + .' {pkt : Packet to process}' + .' {--N|nobot : Dont process bots}' + .' {zone? : Zone the packet is from}'; /** * The console command description. @@ -41,7 +44,7 @@ class PacketProcess extends Command // @todo validate that the packet's zone is in the domain. // Dispatch job. - Job::dispatchSync($msg); + Job::dispatchSync($msg,$this->option('nobot')); } } } diff --git a/app/Jobs/MessageProcess.php b/app/Jobs/MessageProcess.php index 30487a7..eebda34 100644 --- a/app/Jobs/MessageProcess.php +++ b/app/Jobs/MessageProcess.php @@ -19,11 +19,13 @@ class MessageProcess implements ShouldQueue use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; private Message $msg; + private bool $skipbot; - public function __construct(Message $msg) + public function __construct(Message $msg,bool $skipbot=FALSE) { // Some checks $this->msg = $msg; + $this->skipbot = $skipbot; } /** @@ -48,11 +50,12 @@ class MessageProcess implements ShouldQueue $processed = FALSE; // If the message is to a bot, we'll process it - foreach (config('process.robots') as $class) { - if ($processed = $class::handle($this->msg)) { - break; + if (! $this->skipbot) + foreach (config('process.robots') as $class) { + if ($processed = $class::handle($this->msg)) { + break; + } } - } // We'll ignore messages from *fix users if (in_array(strtolower($this->msg->user_from),['filefix','areafix'])) { @@ -218,11 +221,12 @@ class MessageProcess implements ShouldQueue )); // If the message is to a bot, we'll process it - foreach (config('process.echomail') as $class) { - if ($class::handle($this->msg)) { - break; + if (! $this->skipbot) + foreach (config('process.echomail') as $class) { + if ($class::handle($this->msg)) { + break; + } } - } } } } \ No newline at end of file