diff --git a/.env.example b/.env.example index d4e340f1..0d1d5607 100644 --- a/.env.example +++ b/.env.example @@ -76,3 +76,4 @@ TWITCH_OAUTH_CLIENT_SECRET= TWITCH_OAUTH_REDIRECT_URI= DISCORD_TOKEN= +DISCORD_GENERAL_CHAT_ID= \ No newline at end of file diff --git a/app-modules/bot-discord/src/Events/GreetingsEvent.php b/app-modules/bot-discord/src/Events/GreetingsEvent.php index 2bd644d5..95fa47a1 100644 --- a/app-modules/bot-discord/src/Events/GreetingsEvent.php +++ b/app-modules/bot-discord/src/Events/GreetingsEvent.php @@ -27,6 +27,11 @@ public function handle(Message $message, Discord $discord): void return; } + $allowedChannel = config('services.discord.general_chat_id'); + if ($message->channel_id !== $allowedChannel) { + return; + } + $this->logger()->notice(sprintf('%s: %s', $message->author->username, $message->content)); $hour = now()->hour; diff --git a/config/services.php b/config/services.php index 4382bbbf..1cadb5d1 100644 --- a/config/services.php +++ b/config/services.php @@ -39,6 +39,7 @@ 'redirect_uri' => env('DISCORD_OAUTH_REDIRECT_URI', 'https://localhost:8000/auth/oauth/discord'), 'scopes' => env('DISCORD_OAUTH_SCOPES', 'identify email'), 'enabled' => env('DISCORD_OAUTH_ENABLED', true), + 'general_chat_id' => env('DISCORD_GENERAL_CHAT_ID'), ], 'twitch' => [ 'client_id' => env('TWITCH_OAUTH_CLIENT_ID'),