laravel pint format

This commit is contained in:
itsAzaria
2026-02-19 00:40:35 +00:00
parent ac4b6f166f
commit e2fbce88c4
6 changed files with 34 additions and 32 deletions
+6 -3
View File
@@ -5,9 +5,9 @@ namespace App\Events;
use Discord\Discord; use Discord\Discord;
use Discord\Parts\Channel\Message; use Discord\Parts\Channel\Message;
use Discord\WebSockets\Event as Events; use Discord\WebSockets\Event as Events;
use finfo;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Laracord\Events\Event; use Laracord\Events\Event;
use finfo;
class MessageListener extends Event class MessageListener extends Event
{ {
@@ -47,6 +47,7 @@ class MessageListener extends Event
if (! $hasUploadableContent) { if (! $hasUploadableContent) {
$this->sendDisallowedContentMessage($message, $deletedMimeTypes); $this->sendDisallowedContentMessage($message, $deletedMimeTypes);
return; return;
} }
@@ -96,6 +97,7 @@ class MessageListener extends Event
if (! $mimeRule) { if (! $mimeRule) {
$shouldDelete = true; $shouldDelete = true;
$deletedMimeTypes[] = $mimeType; $deletedMimeTypes[] = $mimeType;
continue; continue;
} }
@@ -127,7 +129,7 @@ class MessageListener extends Event
private function uploadToPastecord(array $codeBlocks, array $files): array private function uploadToPastecord(array $codeBlocks, array $files): array
{ {
$pastecord = new \App\Services\Pastecord(); $pastecord = new \App\Services\Pastecord;
foreach ($codeBlocks as $index => $block) { foreach ($codeBlocks as $index => $block) {
if ($block['should_upload']) { if ($block['should_upload']) {
@@ -153,6 +155,7 @@ class MessageListener extends Event
if ($block['should_upload']) { if ($block['should_upload']) {
$responseLines[] = "- **Code Block[{$index}]: **".($block['url'] ?? 'Failed to upload'); $responseLines[] = "- **Code Block[{$index}]: **".($block['url'] ?? 'Failed to upload');
continue; continue;
} }
@@ -208,7 +211,7 @@ class MessageListener extends Event
foreach ($matches as $match) { foreach ($matches as $match) {
$codeBlocks[] = [ $codeBlocks[] = [
'language' => $match[1] ?? '', 'language' => $match[1] ?? '',
'code' => trim($match[2]) 'code' => trim($match[2]),
]; ];
} }
} }
+2
View File
@@ -7,7 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Config extends Model class Config extends Model
{ {
const MAX_CODEBLOCK_SIZE = 'MAX_CODEBLOCK_SIZE'; const MAX_CODEBLOCK_SIZE = 'MAX_CODEBLOCK_SIZE';
const LOGGING_CHANNEL_ID = 'LOGGING_CHANNEL_ID'; const LOGGING_CHANNEL_ID = 'LOGGING_CHANNEL_ID';
protected $fillable = ['key', 'value']; protected $fillable = ['key', 'value'];
public static function get($key, $default = null) public static function get($key, $default = null)
+1
View File
@@ -15,6 +15,7 @@ class Pastecord
'timeout' => 5.0, 'timeout' => 5.0,
]); ]);
} }
public function upload(string $content): string public function upload(string $content): string
{ {
try { try {
+2 -1
View File
@@ -9,6 +9,7 @@ use Laracord\Commands\SlashCommand;
class Config extends SlashCommand class Config extends SlashCommand
{ {
use SlashCommandHelpers; use SlashCommandHelpers;
/** /**
* The command name. * The command name.
* *
@@ -42,7 +43,7 @@ class Config extends SlashCommand
[ [
'name' => 'Logging Channel ID', 'name' => 'Logging Channel ID',
'value' => 'LOGGING_CHANNEL_ID', 'value' => 'LOGGING_CHANNEL_ID',
] ],
], ],
], ],
[ [
+6 -7
View File
@@ -9,6 +9,7 @@ use Laracord\Commands\SlashCommand;
class Mime extends SlashCommand class Mime extends SlashCommand
{ {
use SlashCommandHelpers; use SlashCommandHelpers;
/** /**
* The command name. * The command name.
* *
@@ -82,12 +83,11 @@ class Mime extends SlashCommand
'required' => true, 'required' => true,
], ],
], ],
] ],
], ],
], ],
]; ];
/** /**
* The permissions required to use the command. * The permissions required to use the command.
* *
@@ -135,8 +135,8 @@ class Mime extends SlashCommand
protected function handleAdd($interaction) protected function handleAdd($interaction)
{ {
$mime = $this->value("manage.add.mime"); $mime = $this->value('manage.add.mime');
$handling = $this->value("manage.add.handling"); $handling = $this->value('manage.add.handling');
\App\Models\Mime::updateOrCreate( \App\Models\Mime::updateOrCreate(
['mime' => $mime], ['mime' => $mime],
@@ -152,7 +152,7 @@ class Mime extends SlashCommand
protected function handleRemove($interaction) protected function handleRemove($interaction)
{ {
$mime = $this->value("manage.remove.mime"); $mime = $this->value('manage.remove.mime');
\App\Models\Mime::where('mime', $mime)->delete(); \App\Models\Mime::where('mime', $mime)->delete();
@@ -165,7 +165,7 @@ class Mime extends SlashCommand
protected function handleView($interaction) protected function handleView($interaction)
{ {
$mime = $this->value("manage.view.mime"); $mime = $this->value('manage.view.mime');
$rule = \App\Models\Mime::where('mime', $mime)->first(); $rule = \App\Models\Mime::where('mime', $mime)->first();
@@ -183,5 +183,4 @@ class Mime extends SlashCommand
"The handling rule for mime type `$mime` is `$rule->handling`." "The handling rule for mime type `$mime` is `$rule->handling`."
); );
} }
} }
-4
View File
@@ -2,8 +2,6 @@
namespace App\Traits; namespace App\Traits;
use Discord\Parts\Interactions\Interaction;
trait SlashCommandHelpers trait SlashCommandHelpers
{ {
protected function reply($interaction, string $title, string $content) protected function reply($interaction, string $title, string $content)
@@ -27,7 +25,6 @@ trait SlashCommandHelpers
); );
} }
protected function setConfig($interaction, string $key, $value) protected function setConfig($interaction, string $key, $value)
{ {
$oldValue = \App\Models\Config::get($key); $oldValue = \App\Models\Config::get($key);
@@ -41,7 +38,6 @@ trait SlashCommandHelpers
return $this->reply($interaction, 'Config Updated', $message); return $this->reply($interaction, 'Config Updated', $message);
} }
protected function viewConfig($interaction, string $key) protected function viewConfig($interaction, string $key)
{ {
$currentValue = \App\Models\Config::get($key); $currentValue = \App\Models\Config::get($key);