Skip to content

Commit

Permalink
🩹 Fix empty filename on Message::filePath (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored Aug 20, 2024
1 parent eb9b519 commit 259e319
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Discord/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,8 @@ public function body(string $body = ''): self
/**
* Add a file from content to the message.
*/
public function file(string $content = '', string $filename = ''): self
public function file(string $content = '', string $filename = 'file.txt'): self
{
$filename = $filename ?? 'file.txt';

$this->files[] = [
'content' => $content,
'filename' => $filename,
Expand All @@ -556,7 +554,7 @@ public function file(string $content = '', string $filename = ''): self
/**
* Add a file to the message.
*/
public function filePath(string $path, string $filename = ''): self
public function filePath(string $path, ?string $filename = null): self
{
if (! file_exists($path)) {
$this->bot->console()->error("File <fg=red>{$path}</> does not exist");
Expand Down

0 comments on commit 259e319

Please sign in to comment.