Skip to content

Commit bff40b2

Browse files
authored
[Chore] Refactored Discord notifications to use WebhookCall (alexjustesen#1242)
1 parent 76a0ec4 commit bff40b2

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

app/Listeners/SpeedtestCompletedListener.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use App\Settings\NotificationSettings;
99
use App\Telegram\TelegramNotification;
1010
use Filament\Notifications\Notification;
11-
use Illuminate\Support\Facades\Http;
1211
use Illuminate\Support\Facades\Mail;
1312
use Spatie\WebhookServer\WebhookCall;
1413

@@ -88,8 +87,13 @@ public function handle(ResultCreated $event): void
8887
"\nDownload: ".($event->result->downloadBits / 1000000).' (Mbps)'.
8988
"\nUpload: ".($event->result->uploadBits / 1000000).' (Mbps)',
9089
];
91-
// Send the request using Laravel's HTTP client
92-
$response = Http::post($webhook['url'], $payload);
90+
// Send the payload using WebhookCall
91+
WebhookCall::create()
92+
->url($webhook['url'])
93+
->payload($payload)
94+
->doNotSign()
95+
->dispatch();
96+
9397
}
9498
}
9599
}

app/Listeners/Threshold/AbsoluteListener.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,13 @@ protected function discordChannel(ResultCreated $event): void
265265
'content' => implode("\n", $contentLines),
266266
];
267267

268-
// Send the request using Laravel's HTTP client
269-
$response = Http::post($webhook['url'], $payload);
268+
// Send the payload using WebhookCall
269+
WebhookCall::create()
270+
->url($webhook['url'])
271+
->payload($payload)
272+
->doNotSign()
273+
->dispatch();
274+
270275
}
271276
}
272277
}

0 commit comments

Comments
 (0)