🚧 Initial Discord message components v2 implementation#1294
🚧 Initial Discord message components v2 implementation#1294valzargaming merged 29 commits intomasterfrom
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. |
SQKo
left a comment
There was a problem hiding this comment.
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.
Implement validation of $url like in Embed::ensureValidUrl()
There was a problem hiding this comment.
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.
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.