Skip to content

Commit d76d2b1

Browse files
committed
fix channel createaable attributes type checking
1 parent 1e36479 commit d76d2b1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/Discord/Parts/Channel/Channel.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,13 @@ public function getCreatableAttributes(): array
14201420
'position' => $this->position,
14211421
]);
14221422

1423+
if (null === $this->type) {
1424+
// Type was not specified but we must not assume its default to GUILD_TEXT as that is determined by API
1425+
$this->discord->getLogger()->warning('Not specifying channel type, creating with all filled attributes');
1426+
$attr += $this->getRawAttributes(); // Send the remaining raw attributes
1427+
return $attr;
1428+
}
1429+
14231430
switch ($this->type) {
14241431
case self::TYPE_GUILD_TEXT:
14251432
$attr += $this->makeOptionalAttributes([
@@ -1479,12 +1486,6 @@ public function getCreatableAttributes(): array
14791486
'default_thread_rate_limit_per_user' => $this->default_thread_rate_limit_per_user, // Canceled documentation #5606
14801487
]);
14811488
break;
1482-
1483-
case null:
1484-
// Type was not specified but we must not assume its default to GUILD_TEXT as that is determined by API
1485-
$this->discord->getLogger()->warning('Not specifying channel type, creating with all filled attributes');
1486-
$attr += $this->getRawAttributes(); // Send the remaining raw attributes
1487-
break;
14881489
}
14891490

14901491
return $attr;

0 commit comments

Comments
 (0)