-
-
Notifications
You must be signed in to change notification settings - Fork 762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[9.x] username
parameter in from
method should be nullable
#1817
Conversation
from
method should be nullablefrom
method should be nullable
from
method should be nullableusername
parameter in from
method should be nullable
This won't actually fix the issue. The error in the original issue states that the username must be between 1 and 80 characters:
Checking for null doesn't solve that. I suggest that instead of changing the signature to allow nulls, don't add the As per the Discord documentation, the public function toArray()
{
$data = [
'avatar_url' => $this->avatarUrl,
'embeds' => [
[
'title' => $this->title,
'url' => $this->url,
'type' => 'rich',
'description' => $this->description,
'fields' => $this->fields,
'color' => hexdec((string) $this->color),
'footer' => [
'text' => $this->footer ?? '',
],
'timestamp' => $this->timestamp ?? now(),
],
],
];
if (!empty($this->username)) {
$data['username'] = $this->username;
}
return $data;
} Will address this point properly. When the The same applies #1818, which I believe could just be backported. |
@RVxLab You're right, this doesn't fix the issue the way you want. I initially suggested this PR because if you don't specify I've considered this further. I was torn between making Let's wait for input from a maintainer before modifying the PRs with your suggestion. |
This isn't about what I want or don't want. Changing the username from If the Based on this and Discord's documentation stating that it's an optional field (analogous to |
@RVxLab I found this PR #1634 that addresses the same issue as mine. It suggests replacing an empty string with Laravel Backup, ensuring that a username is always returned. This is likely the behavior they want to maintain. We should wait for a response from @freekmurze. The wrong comment in the config file should probably be modified. |
Fixed by #1634 |
Based on issue #1815,
username
parameter infrom
method should be nullable inDiscordMessage.php
on line13
:src/Notifications/Channels/Discord/DiscordMessage.php