-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandomBlunder.php
40 lines (30 loc) · 1.36 KB
/
randomBlunder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
use App\Exception\ExceptionHandler;
use App\Service\Blunder\BlunderCreationServiceFactory;
use App\Service\Blunder\Chessblundersorg\ChessBlundersBlunderCreationService;
use App\Service\Blunder\Chessblundersorg\ChessBlundersRandomGetBlunderService;
use App\Service\Blunder\Lichessorg\LichessBlunderCreationService;
use App\Service\Blunder\Lichessorg\LichessRandomGetBlunderService;
use App\Service\Channel\DiscordChannelFactory;
use App\Service\Embed\CreateBlunderEmbedMessageService;
use App\Service\Message\SendMessageService;
use Discord\Discord;
try {
include __DIR__.'/core/bootstrap.php';
$discord = discordApp();
$blunderCreationService = new BlunderCreationServiceFactory(new LichessBlunderCreationService(new LichessRandomGetBlunderService()));
$blunder = $blunderCreationService->createBlunder();
$embed = new CreateBlunderEmbedMessageService($blunder);
$embed = $embed->createEmbed();
$discord->on('ready', function (Discord $discord) use ($embed) {
echo "Bot is ready!", PHP_EOL;
$channel = DiscordChannelFactory::getDefaultChannel();
SendMessageService::sendEmbedMessage($embed, $channel, function () {
die();
});
});
$discord->run();
} catch (Throwable $throwable) {
$exceptionHandler = new ExceptionHandler();
$exceptionHandler->handle($throwable, basename(__FILE__, '.php'));
}