forked from he4rt/heartdevs.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBotDiscordServiceProvider.php
More file actions
48 lines (38 loc) · 1.48 KB
/
Copy pathBotDiscordServiceProvider.php
File metadata and controls
48 lines (38 loc) · 1.48 KB
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
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
namespace He4rt\BotDiscord;
use He4rt\BotDiscord\Listeners\NotifyModerationChannel;
use He4rt\BotDiscord\Moderation\DiscordModerationAdapter;
use He4rt\Moderation\Cases\Events\CaseQueued;
use Illuminate\Support\Facades\Event;
use Laracord\Laracord;
use Laracord\LaracordServiceProvider;
class BotDiscordServiceProvider extends LaracordServiceProvider
{
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/bot-discord.php', 'bot-discord');
$this->app->singleton(DiscordModerationAdapter::class);
$this->app->tag([DiscordModerationAdapter::class], 'moderation.platforms');
parent::register();
}
public function boot(): void
{
parent::boot();
Event::listen(CaseQueued::class, [NotifyModerationChannel::class, 'handle']);
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/bot-discord.php' => config_path('bot-discord.php'),
], 'bot-discord-config');
}
}
public function bot(Laracord $bot): Laracord
{
return $bot
->disableHttpServer()
->discoverEvents(__DIR__.'/Events', 'He4rt\BotDiscord\Events')
->discoverCommands(__DIR__.'/Commands', 'He4rt\BotDiscord\Commands')
->discoverSlashCommands(__DIR__.'/SlashCommands', 'He4rt\BotDiscord\SlashCommands')
->discoverTasks(__DIR__.'/Tasks', 'He4rt\BotDiscord\Tasks');
}
}