File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
src/Discord/Parts/Channel Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 3131use Discord \Parts \Guild \Guild ;
3232use Discord \Parts \Guild \Sticker ;
3333use Discord \Parts \Interactions \Request \Component ;
34+ use Discord \Builders \Components \Component as ComponentBuilder ;
3435use Discord \Parts \Thread \Thread ;
3536use Discord \Parts \WebSockets \MessageInteraction ;
3637use Discord \Repository \Channel \ReactionRepository ;
@@ -728,10 +729,16 @@ protected function getComponentsAttribute(): ?ExCollectionInterface
728729 return null ;
729730 }
730731
731- $ components = Collection::for (Component ::class, null );
732+ $ components = Collection::for (ComponentBuilder ::class, null );
732733
733- foreach ($ this ->attributes ['components ' ] as $ component ) {
734- $ components ->pushItem ($ this ->createOf (Component::class, $ component ));
734+ foreach ($ this ->attributes ['components ' ] ?? [] as $ component ) {
735+ $ componentType = (is_object ($ component )) ? (isset ($ component ->type ) ? $ component ->type : 0 ) : ($ component ['type ' ] ?? 0 );
736+ $ components ->pushItem (
737+ isset (ComponentBuilder::TYPE_CLASSES [$ componentType ])
738+ ? (new (ComponentBuilder::TYPE_CLASSES [$ componentType ]))->fill ((array ) $ component )
739+ : (new ComponentBuilder ())->fill ((array ) $ component ),
740+ $ component
741+ );
735742 }
736743
737744 return $ components ;
You can’t perform that action at this time.
0 commit comments