Skip to content

Commit a31ff86

Browse files
committed
ActionRow::addComponents()
Also removed typing on Container::addComponents so a Collection or other type of array can be used.
1 parent 2b9ed53 commit a31ff86

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Discord/Builders/Components/ActionRow.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,24 @@ public function addComponent(ComponentObject $component): self
8383
return $this;
8484
}
8585

86+
/**
87+
* Add a group of components to the action row.
88+
*
89+
* @param ComponentObject[] $components Components to add.
90+
*
91+
* @throws \InvalidArgumentException Component is not a valid type.
92+
*
93+
* @return $this
94+
*/
95+
public function addComponents($components): self
96+
{
97+
foreach ($components as $component) {
98+
$this->addComponent($component);
99+
}
100+
101+
return $this;
102+
}
103+
86104
/**
87105
* Removes a component from the action row.
88106
*

src/Discord/Builders/Components/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function addComponent(ComponentObject $component): self
130130
*
131131
* @return $this
132132
*/
133-
public function addComponents(array $components): self
133+
public function addComponents($components): self
134134
{
135135
foreach ($components as $component) {
136136
$this->addComponent($component);

0 commit comments

Comments
 (0)