Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions app/Models/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Jobs\Analysis\AnalyzeEmotesJob;
use App\Jobs\SingleChatMessageJob;
use App\Services\CommandService;
use App\Services\MessageService;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;
use Laravel\Pennant\Feature;
Expand Down Expand Up @@ -57,15 +58,19 @@ protected static function booted()
return;
}

Feature::when(
'auto-caps-punishment',
whenActive: fn () => AnalyzeCapsJob::dispatchSync($message),
);
$messageService = MessageService::message($message);

Feature::when(
'auto-max-emotes-punishment',
whenActive: fn () => AnalyzeEmotesJob::dispatchSync($message),
);
if (! $messageService->isModerator()) {
Feature::when(
'auto-caps-punishment',
whenActive: fn () => AnalyzeCapsJob::dispatchSync($message),
);

Feature::when(
'auto-max-emotes-punishment',
whenActive: fn () => AnalyzeEmotesJob::dispatchSync($message),
);
}

try {
$commandService = CommandService::message($message);
Expand Down
10 changes: 9 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
use App\Models\Channel;
use App\Models\User;
use Illuminate\Database\Eloquent\BroadcastableModelEventOccurred;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
use Laravel\Nightwatch\Facades\Nightwatch;
use Laravel\Nightwatch\Records\Query;
use Laravel\Nightwatch\Records\QueuedJob;
use Laravel\Pennant\Feature;
use Laravel\Pulse\Facades\Pulse;
use Throwable;

class AppServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -77,7 +79,13 @@ private function setNightwatchSampleRate(): void
]);
});

$channel = Channel::where('twitch_channel_id', config('services.twitch.channel_id'))->first();
try {
$channel = Channel::where('twitch_channel_id', config('services.twitch.channel_id'))->first();
} catch (Throwable $e) {
Log::error('Failed to get channel for bot from database', ['error' => $e->getMessage()]);

return;
}

if ($channel && $channel->is_live) {
return;
Expand Down
20 changes: 9 additions & 11 deletions docker/8.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,20 @@ RUN apt-get update && apt-get upgrade -y \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu noble main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.4-cli php8.4-dev \
php8.4-pgsql php8.4-sqlite3 php8.4-gd \
php8.4-curl php8.4-mongodb \
php8.4-imap php8.4-mysql php8.4-mbstring \
php8.4-xml php8.4-zip php8.4-bcmath php8.4-soap \
php8.4-intl php8.4-readline \
php8.4-ldap \
php8.4-msgpack php8.4-igbinary php8.4-redis php8.4-swoole \
php8.4-memcached php8.4-pcov php8.4-imagick php8.4-xdebug \
php8.4-pgsql php8.4-sqlite3 php8.4-gd \
php8.4-curl php8.4-mongodb \
php8.4-imap php8.4-mysql php8.4-mbstring \
php8.4-xml php8.4-zip php8.4-bcmath php8.4-soap \
php8.4-intl php8.4-readline \
php8.4-ldap \
php8.4-msgpack php8.4-igbinary php8.4-redis php8.4-swoole \
php8.4-memcached php8.4-pcov php8.4-imagick php8.4-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& npm install -g pnpm \
&& npm install -g bun \
&& npm install -g npm@10.9.8 && npm install -g npm@latest \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null \
Expand Down
Loading