-
-
Notifications
You must be signed in to change notification settings - Fork 245
🚧 Initial Discord message components v2 implementation #1294
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
Conversation
The v2 contract was an excellent idea, and something I'd like to see in other parts of the library. It would certainly cut down on a lost of instances of checking against hardcoded types like this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also adjust the class implements Components\xx
to have the namespace imported per my previous suggestion
public function setUrl(string $url): self | ||
{ | ||
$this->url = $url; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement validation of $url
like in Embed::ensureValidUrl()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know if it's the same spec? We could just copy-paste the function here and do the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've confirmed it's exactly the same except for File, in which case only attachment is allowed.
According to the spec, using the components v2 may disable content and embeds, it would be good to warn the users in the MessageBuilder to avoid confusion Also seems this PR has not supported webhooks yet |
Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>
Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>
Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>
Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>
Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>
Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>
PHPDoc specifies the current restrictions on Thumbnail and Button, but the datatype should be left open as Component for now as this list of possible returns may be subject to change.
Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>
It always returns 0 if it would otherwise be null
Co-authored-by: SQKo <87897282+SQKo@users.noreply.github.com>
Co-authored-by: Exanlv <51094537+Exanlv@users.noreply.github.com>
🚧 Work in progress.
Completely blind & untested. Should be able to try it later today.
Edit: everything appears to be functional.