mirror of
https://github.com/the-programmers-hangout/Mimic.git
synced 2026-09-04 01:06:00 +02:00
laravel pint format
This commit is contained in:
@@ -5,9 +5,9 @@ namespace App\Events;
|
||||
use Discord\Discord;
|
||||
use Discord\Parts\Channel\Message;
|
||||
use Discord\WebSockets\Event as Events;
|
||||
use finfo;
|
||||
use Illuminate\Support\Str;
|
||||
use Laracord\Events\Event;
|
||||
use finfo;
|
||||
|
||||
class MessageListener extends Event
|
||||
{
|
||||
@@ -47,6 +47,7 @@ class MessageListener extends Event
|
||||
|
||||
if (! $hasUploadableContent) {
|
||||
$this->sendDisallowedContentMessage($message, $deletedMimeTypes);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,6 +97,7 @@ class MessageListener extends Event
|
||||
if (! $mimeRule) {
|
||||
$shouldDelete = true;
|
||||
$deletedMimeTypes[] = $mimeType;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -127,7 +129,7 @@ class MessageListener extends Event
|
||||
|
||||
private function uploadToPastecord(array $codeBlocks, array $files): array
|
||||
{
|
||||
$pastecord = new \App\Services\Pastecord();
|
||||
$pastecord = new \App\Services\Pastecord;
|
||||
|
||||
foreach ($codeBlocks as $index => $block) {
|
||||
if ($block['should_upload']) {
|
||||
@@ -153,6 +155,7 @@ class MessageListener extends Event
|
||||
|
||||
if ($block['should_upload']) {
|
||||
$responseLines[] = "- **Code Block[{$index}]: **".($block['url'] ?? 'Failed to upload');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -208,7 +211,7 @@ class MessageListener extends Event
|
||||
foreach ($matches as $match) {
|
||||
$codeBlocks[] = [
|
||||
'language' => $match[1] ?? '',
|
||||
'code' => trim($match[2])
|
||||
'code' => trim($match[2]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Config extends Model
|
||||
{
|
||||
const MAX_CODEBLOCK_SIZE = 'MAX_CODEBLOCK_SIZE';
|
||||
|
||||
const LOGGING_CHANNEL_ID = 'LOGGING_CHANNEL_ID';
|
||||
|
||||
protected $fillable = ['key', 'value'];
|
||||
|
||||
public static function get($key, $default = null)
|
||||
|
||||
@@ -15,6 +15,7 @@ class Pastecord
|
||||
'timeout' => 5.0,
|
||||
]);
|
||||
}
|
||||
|
||||
public function upload(string $content): string
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -9,6 +9,7 @@ use Laracord\Commands\SlashCommand;
|
||||
class Config extends SlashCommand
|
||||
{
|
||||
use SlashCommandHelpers;
|
||||
|
||||
/**
|
||||
* The command name.
|
||||
*
|
||||
@@ -42,7 +43,7 @@ class Config extends SlashCommand
|
||||
[
|
||||
'name' => 'Logging Channel ID',
|
||||
'value' => 'LOGGING_CHANNEL_ID',
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
||||
@@ -9,6 +9,7 @@ use Laracord\Commands\SlashCommand;
|
||||
class Mime extends SlashCommand
|
||||
{
|
||||
use SlashCommandHelpers;
|
||||
|
||||
/**
|
||||
* The command name.
|
||||
*
|
||||
@@ -82,12 +83,11 @@ class Mime extends SlashCommand
|
||||
'required' => true,
|
||||
],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* The permissions required to use the command.
|
||||
*
|
||||
@@ -135,8 +135,8 @@ class Mime extends SlashCommand
|
||||
|
||||
protected function handleAdd($interaction)
|
||||
{
|
||||
$mime = $this->value("manage.add.mime");
|
||||
$handling = $this->value("manage.add.handling");
|
||||
$mime = $this->value('manage.add.mime');
|
||||
$handling = $this->value('manage.add.handling');
|
||||
|
||||
\App\Models\Mime::updateOrCreate(
|
||||
['mime' => $mime],
|
||||
@@ -152,7 +152,7 @@ class Mime extends SlashCommand
|
||||
|
||||
protected function handleRemove($interaction)
|
||||
{
|
||||
$mime = $this->value("manage.remove.mime");
|
||||
$mime = $this->value('manage.remove.mime');
|
||||
|
||||
\App\Models\Mime::where('mime', $mime)->delete();
|
||||
|
||||
@@ -165,7 +165,7 @@ class Mime extends SlashCommand
|
||||
|
||||
protected function handleView($interaction)
|
||||
{
|
||||
$mime = $this->value("manage.view.mime");
|
||||
$mime = $this->value('manage.view.mime');
|
||||
|
||||
$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`."
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Discord\Parts\Interactions\Interaction;
|
||||
|
||||
trait SlashCommandHelpers
|
||||
{
|
||||
protected function reply($interaction, string $title, string $content)
|
||||
@@ -27,7 +25,6 @@ trait SlashCommandHelpers
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected function setConfig($interaction, string $key, $value)
|
||||
{
|
||||
$oldValue = \App\Models\Config::get($key);
|
||||
@@ -41,7 +38,6 @@ trait SlashCommandHelpers
|
||||
return $this->reply($interaction, 'Config Updated', $message);
|
||||
}
|
||||
|
||||
|
||||
protected function viewConfig($interaction, string $key)
|
||||
{
|
||||
$currentValue = \App\Models\Config::get($key);
|
||||
|
||||
Reference in New Issue
Block a user