Skip to content

Commit

Permalink
Merge pull request #849 from SQKo/master
Browse files Browse the repository at this point in the history
ran composer run-script cs
  • Loading branch information
SQKo authored Jul 2, 2022
2 parents ac72327 + cc0a6e5 commit bd8895c
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 25 deletions.
6 changes: 3 additions & 3 deletions src/Discord/Builders/CommandAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use function Discord\poly_strlen;

/**
* Application Command attributes
* Application Command attributes.
*
* @see Discord\Builders\CommandBuilder
* @see Discord\Parts\Interactions\Command\Command
Expand All @@ -32,8 +32,8 @@
* @property bool|null $dm_permission Indicates whether the command is available in DMs with the app, only for globally-scoped commands. By default, commands are visible.
* @property ?bool $default_permission Whether the command is enabled by default when the app is added to a guild. SOON DEPRECATED.
*/
trait CommandAttributes {

trait CommandAttributes
{
/**
* Whether the command is enabled by default when the app is added to a guild. SOON DEPRECATED.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Builders/MessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MessageBuilder implements JsonSerializable
private $content;

/**
* A nonce that can be used for message roundtrips with the gateway (up to 25 characters)
* A nonce that can be used for message roundtrips with the gateway (up to 25 characters).
*
* @var int|string|null
*/
Expand Down
1 change: 0 additions & 1 deletion src/Discord/Discord.php
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,6 @@ protected function setGateway(?string $gateway = null): ExtendedPromiseInterface
'encoding' => $this->encoding,
];


if (class_exists('\Clue\React\Zlib\Decompressor')) {
$this->logger->warning('The `clue/reactphp-zlib` is present, Enabling experimental zlib-stream compressed gateway message.');
$this->zlibDecompressor = new \Clue\React\Zlib\Decompressor(ZLIB_ENCODING_DEFLATE);
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Helpers/Bitwise.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Bitwise
private static bool $is_32_gmp = false;

/**
* Run a single check whether the GMP extension is loaded
* Run a single check whether the GMP extension is loaded.
*
* @internal internally used during Discord class construct.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/Guild/Ban.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Ban extends Part

// internally used
'user_id',
'guild_id'
'guild_id',
];

/**
Expand Down
14 changes: 7 additions & 7 deletions src/Discord/Parts/Guild/Guild.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ public function getVoiceRegions(): ExtendedPromiseInterface
*
* @see https://discord.com/developers/docs/resources/guild#create-guild-role
*
* @param array $data The data to fill the role with.
* @param array $data The data to fill the role with.
* @param string|null $reason Reason for Audit Log.
*
* @throws NoPermissionsException
Expand Down Expand Up @@ -726,8 +726,8 @@ public function createSticker(array $options, string $filepath, ?string $reason
'filename' => basename($filepath),
'content' => $contents,
'headers' => [
'Content-Type' => $contentType
]
'Content-Type' => $contentType,
],
],
]);

Expand Down Expand Up @@ -1113,10 +1113,10 @@ public function getWidgetSettings(): ExtendedPromiseInterface
*
* @see https://discord.com/developers/docs/resources/guild#modify-guild-widget
*
* @param array $options An array of options.
* enabled => whether the widget is enabled
* channel_id => the widget channel id
* @param string $reason Reason for Audit Log.
* @param array $options An array of options.
* enabled => whether the widget is enabled
* channel_id => the widget channel id
* @param string $reason Reason for Audit Log.
*
* @return ExtendedPromiseInterface The updated guild widget object.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/Interactions/Command/Overwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getRepositoryAttributes(): array

/**
* Get the permission ID constant for All Channels in the guild (i.e. guild_id - 1)
* Requires GMP extension loaded on 32 bits PHP
* Requires GMP extension loaded on 32 bits PHP.
*
* @see https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-constants
*
Expand Down
4 changes: 3 additions & 1 deletion src/Discord/Parts/Interactions/Interaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Interaction extends Part

/**
* Returns true if this interaction has been internally responded.
*
*
* @return bool The interaction is responded
*/
public function isResponded(): bool
Expand Down Expand Up @@ -283,6 +283,7 @@ public function getOriginalResponse(): ExtendedPromiseInterface
return $this->http->get(Endpoint::bind(Endpoint::ORIGINAL_INTERACTION_RESPONSE, $this->application_id, $this->token))
->then(function ($response) {
$this->responded = true;

return $this->factory->create(Message::class, $response, true);
});
}
Expand Down Expand Up @@ -487,6 +488,7 @@ public function getFollowUpMessage(string $message_id): ExtendedPromiseInterface
return $this->http->get(Endpoint::bind(Endpoint::INTERACTION_FOLLOW_UP, $this->application_id, $this->token, $message_id))
->then(function ($response) {
$this->responded = true;

return $this->factory->create(Message::class, $response, true);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/User/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ public function getVoiceChannel(): ?Channel
{
return $this->guild->channels->find(function (Channel $channel) {
return $channel->allowVoice() && isset($channel->members[$this->id]);
});
});
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Parts/WebSockets/MessageInteraction.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MessageInteraction extends Part
'member',

// internal
'guild_id'
'guild_id',
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Repository/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function create(array $attributes = [], bool $created = false): Part
/**
* Attempts to save a part to the Discord servers.
*
* @param Part $part The part to save.
* @param Part $part The part to save.
* @param string|null $reason Reason for Audit Log (if supported).
*
* @return ExtendedPromiseInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Repository/Channel/ThreadRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ThreadRepository extends AbstractRepository
'get' => Endpoint::THREAD,
'update' => Endpoint::THREAD,
'delete' => Endpoint::THREAD,
'create' => Endpoint::CHANNEL_THREADS
'create' => Endpoint::CHANNEL_THREADS,
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Discord/Repository/Guild/BanRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function ban($member, ?int $daysToDeleteMessages = null, ?string $reason
*
* @see https://discord.com/developers/docs/resources/guild#remove-guild-ban
*
* @param User|Ban|string $user User or Ban Part, or User ID
* @param User|Ban|string $user User or Ban Part, or User ID
* @param string|null $reason Reason for Audit Log.
*
* @return ExtendedPromiseInterface
Expand Down
1 change: 1 addition & 0 deletions src/Discord/Repository/Guild/MemberRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public function freshen(array $queryparams = null): ExtendedPromiseInterface
$this->http->get($endpoint)->then(function ($response) use ($paginate, $deferred, $afterId) {
if (empty($response)) {
$deferred->resolve($this);

return;
} elseif (! $afterId) {
$this->clear();
Expand Down
1 change: 1 addition & 0 deletions src/Discord/WebSockets/Events/GuildCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public function handle(Deferred &$deferred, $data)
$this->http->get($bind)->done(function ($rawBans) use (&$banPagination, $guildPart, $resolve) {
if (empty($rawBans)) {
$resolve();

return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Discord/WebSockets/Intents.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@ class Intents

/**
* Auto moderation rule events:.
*
*
* - AUTO_MODERATION_RULE_CREATE
* - AUTO_MODERATION_RULE_UPDATE
* - AUTO_MODERATION_RULE_DELETE
*/
public const AUTO_MODERATION_CONFIGURATION = (1 << 20);

/**
* Auto moderation execution events:
*
* Auto moderation execution events:.
*
* - AUTO_MODERATION_ACTION_EXECUTION
*/
public const AUTO_MODERATION_EXECUTION = (1 << 21);
Expand Down
4 changes: 3 additions & 1 deletion src/Discord/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function escapeMarkdown(string $text): string
}

/**
* Run a deferred search in array
* Run a deferred search in array.
*
* @param array|object $array Traversable, use $collection->getIterator() if searching in Collection
* @param callable $callback The filter function to run
Expand All @@ -282,13 +282,15 @@ function deferFind($array, callable $callback, $loop, ?callable $canceller = nul
if (! $iterator->valid()) {
$loop->cancelTimer($timer);
$deferred->reject();

return;
}

$current = $iterator->current();
if ($callback($current)) {
$loop->cancelTimer($timer);
$deferred->resolve($current);

return;
}

Expand Down

0 comments on commit bd8895c

Please sign in to comment.