mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-22 01:38:49 -05:00
update: auto pre warnings
This commit is contained in:
@@ -16,6 +16,7 @@ namespace App\Console\Commands;
|
||||
use App\Models\History;
|
||||
use App\Models\PrivateMessage;
|
||||
use App\Models\Warning;
|
||||
use App\Notifications\UserPreWarning;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
@@ -75,15 +76,8 @@ class AutoPreWarning extends Command
|
||||
if ($exsist === null) {
|
||||
$timeleft = \config('hitrun.grace') - \config('hitrun.prewarn');
|
||||
|
||||
// Send Private Message
|
||||
$pm = new PrivateMessage();
|
||||
$pm->sender_id = 1;
|
||||
$pm->receiver_id = $pre->user->id;
|
||||
$pm->subject = 'Hit and Run Warning Incoming';
|
||||
$pm->message = 'You have received a automated [b]PRE-WARNING PM[/b] from the system because [b]you have been disconnected for '.\config('hitrun.prewarn').\sprintf(' days on Torrent %s
|
||||
and have not yet met the required seedtime rules set by ', $pre->torrent->name).\config('other.title').\sprintf('. If you fail to seed it within %s day(s) you will receive a automated WARNING which will last ', $timeleft).\config('hitrun.expire').' days![/b]
|
||||
[color=red][b] THIS IS AN AUTOMATED SYSTEM MESSAGE, PLEASE DO NOT REPLY![/b][/color]';
|
||||
$pm->save();
|
||||
// Send Notifications
|
||||
$pre->user->notify(new UserPreWarning($pre->user, $pre->torrent));
|
||||
|
||||
// Set History Prewarn
|
||||
$pre->prewarn = 1;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\Torrent;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
@@ -14,7 +16,7 @@ class UserPreWarning extends Notification
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(public User $user, public Torrent $torrent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user