Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Discord/Discord.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class Discord
/**
* An array of registered slash commands.
*
* @var RegisteredCommand[]
* @var ExCollectionInterface<RegisteredCommand>|RegisteredCommand[]
*/
protected $application_commands;

Expand Down Expand Up @@ -401,6 +401,7 @@ public function __construct(array $options = [])
$this->token = $options['token'];
$this->loop = $options['loop'];
$this->logger = $options['logger'];
$this->application_commands = Collection::for(RegisteredCommand::class, 'name');

if (! in_array(php_sapi_name(), ['cli', 'micro'])) {
$this->logger->critical('DiscordPHP will not run on a webserver. Please use PHP CLI to run a DiscordPHP bot.');
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/PartTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ protected function attributeCollectionHelper($key, $class, ?string $discrim = 'i
{
$collection = Collection::for($class, $discrim);

if (! isset($this->attributes[$key])) {
if (empty($this->attributes[$key])) {
return $collection;
}

Expand Down