Skip to content

Commit d33e789

Browse files
cryptiklemurveteran29HilbertGilbertsonprryplatypusAndrey
authored
Backmerge to develop (restcord#147)
* Allowing new versions of PHP, Symfony, PHPUnit (restcord#144) * Allow symfony 5 (restcord#106) * Added premium_since to GuildMember model (restcord#116) Note that I was unable to utilise the downloadServiceDefinition binary, as it is dependent upon a web resource that no longer appears to exist (https://discord-service-definition.herokuapp.com/) Accordingly, GuildMember.php had to be edited manually, along with the service definition file. * Back Merge (restcord#136) * Updated Discord's API URL (restcord#119) From the announcement made in the Developers server: :mega: API Updates :mega: Discord has finally made the switch to discord.com :tada: With this change also means that the API endpoint is moving too! Please start moving your libraries, webhooks, and integrations over to using discord.com in place of discordapp.com. We currently plan to start requiring the new domain later this year for third party developers on November 7th, 2020. We will be sending out more formal notices (system DMs and account emails) to announce this breaking change in the coming weeks. * Allow symfony 5 (restcord#106) (restcord#120) Co-authored-by: Filip Maciejewski <[email protected]> * Better options parsing (restcord#125) Custom options overrides defaults * Better options parsing (restcord#125) Custom options overrides defaults * Fix style CI (restcord#127) phpdoc_to_comment cant be disabled since it is not enabled in the preset. https://docs.styleci.io/presets * Update LICENSE (restcord#130) * Update README.md (restcord#131) * Fix RateLimiter (exclude minor parameters) (restcord#126) * Simplify getRoute with explicit cast, Remove unecessary duplicate call to getUri, * Crude minor parameter removal * Improve error handling, * Fix styleci * Revert last change * Use while for delay to not interfere when multiple requests are delayed, * Update src/RateLimit/Provider/AbstractRateLimitProvider.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Add new line at EOF Co-authored-by: Aaron Scherer <[email protected]> * Laravel wrapped moved to GitHub (restcord#132) * Added with_counts query parameter to getGuild (restcord#133) * Added with_counts to getGuild * Updated type to be boolean * Allowing avatars to be treated as strings (restcord#134) * Allowing avatars to be treated as strings * Maintaining strongly typed comparisons * Develop (restcord#135) * Allow symfony 5 (restcord#106) * Added premium_since to GuildMember model (restcord#116) Note that I was unable to utilise the downloadServiceDefinition binary, as it is dependent upon a web resource that no longer appears to exist (https://discord-service-definition.herokuapp.com/) Accordingly, GuildMember.php had to be edited manually, along with the service definition file. Co-authored-by: Filip Maciejewski <[email protected]> Co-authored-by: HilbertGilbertson <[email protected]> Co-authored-by: Néstor Pérez <[email protected]> Co-authored-by: Filip Maciejewski <[email protected]> Co-authored-by: Andrey <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Ben Kuhl <[email protected]> Co-authored-by: HilbertGilbertson <[email protected]> * Allow PHP 8.0 (restcord#143) * Updated Discord's API URL (restcord#119) From the announcement made in the Developers server: :mega: API Updates :mega: Discord has finally made the switch to discord.com :tada: With this change also means that the API endpoint is moving too! Please start moving your libraries, webhooks, and integrations over to using discord.com in place of discordapp.com. We currently plan to start requiring the new domain later this year for third party developers on November 7th, 2020. We will be sending out more formal notices (system DMs and account emails) to announce this breaking change in the coming weeks. * Allow symfony 5 (restcord#106) (restcord#120) Co-authored-by: Filip Maciejewski <[email protected]> * Better options parsing (restcord#125) Custom options overrides defaults * Better options parsing (restcord#125) Custom options overrides defaults * Fix style CI (restcord#127) phpdoc_to_comment cant be disabled since it is not enabled in the preset. https://docs.styleci.io/presets * Update LICENSE (restcord#130) * Update README.md (restcord#131) * Fix RateLimiter (exclude minor parameters) (restcord#126) * Simplify getRoute with explicit cast, Remove unecessary duplicate call to getUri, * Crude minor parameter removal * Improve error handling, * Fix styleci * Revert last change * Use while for delay to not interfere when multiple requests are delayed, * Update src/RateLimit/Provider/AbstractRateLimitProvider.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Update src/RateLimit/RateLimiter.php Co-authored-by: Aaron Scherer <[email protected]> * Add new line at EOF Co-authored-by: Aaron Scherer <[email protected]> * Laravel wrapped moved to GitHub (restcord#132) * Added with_counts query parameter to getGuild (restcord#133) * Added with_counts to getGuild * Updated type to be boolean * Allowing avatars to be treated as strings (restcord#134) * Allowing avatars to be treated as strings * Maintaining strongly typed comparisons * Develop (restcord#135) * Allow symfony 5 (restcord#106) * Added premium_since to GuildMember model (restcord#116) Note that I was unable to utilise the downloadServiceDefinition binary, as it is dependent upon a web resource that no longer appears to exist (https://discord-service-definition.herokuapp.com/) Accordingly, GuildMember.php had to be edited manually, along with the service definition file. Co-authored-by: Filip Maciejewski <[email protected]> Co-authored-by: HilbertGilbertson <[email protected]> * Adding public properties (restcord#137) * Improve User Avatar (restcord#138) See : https://discord.com/developers/docs/reference#image-formatting-cdn-endpoints Signed-off-by: Dark❶ <[email protected]> * Allow PHP 8.0 * Apply suggestions from code review Co-authored-by: Aaron Scherer <[email protected]> * fix symfony/options-resolver version constraint * Remove old PHP versions from travis Co-authored-by: Néstor Pérez <[email protected]> Co-authored-by: Aaron Scherer <[email protected]> Co-authored-by: Filip Maciejewski <[email protected]> Co-authored-by: Andrey <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Ben Kuhl <[email protected]> Co-authored-by: HilbertGilbertson <[email protected]> Co-authored-by: Dark❶ <[email protected]> Co-authored-by: Filip Maciejewski <[email protected]> Co-authored-by: HilbertGilbertson <[email protected]> Co-authored-by: Néstor Pérez <[email protected]> Co-authored-by: Andrey <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Ben Kuhl <[email protected]> Co-authored-by: iggyvolz <[email protected]> Co-authored-by: Dark❶ <[email protected]> * Apply fixes from StyleCI [ci skip] [skip ci] Co-authored-by: Filip Maciejewski <[email protected]> Co-authored-by: HilbertGilbertson <[email protected]> Co-authored-by: Néstor Pérez <[email protected]> Co-authored-by: Andrey <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Ben Kuhl <[email protected]> Co-authored-by: iggyvolz <[email protected]> Co-authored-by: Dark❶ <[email protected]> Co-authored-by: Aaron Scherer <[email protected]>
1 parent 93cc1d6 commit d33e789

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

bin/stupidFunctionalTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ function ($severity, $message, $file, $line) {
139139
'channel.id' => $dm->id,
140140
'embed' => [
141141
'title' => 'RestCord test at: '.date(
142-
'Y-m-d H:i:s'
143-
),
142+
'Y-m-d H:i:s'
143+
),
144144
],
145145
]
146146
);

src/RateLimit/Provider/AbstractRateLimitProvider.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ abstract class AbstractRateLimitProvider
3232
*/
3333
public function getRoute(RequestInterface $request)
3434
{
35-
$route = (string)$request->getUri();
35+
$route = (string) $request->getUri();
3636

3737
if ($request->getMethod() === 'DELETE' && strpos($route, 'messages') !== false) {
38-
$route = 'DELETE-' . $route;
38+
$route = 'DELETE-'.$route;
3939
}
4040

4141
$stripped = $this->stripMinorParameters($route);
@@ -101,27 +101,27 @@ abstract public function setRequestAllowance(RequestInterface $request, Response
101101
/**
102102
* Method to match out major parameters of the route and
103103
* remove minor parameters / numbers. This has to be done
104-
* to ensure correct rate limiting according to:
105-
* https://discord.com/developers/docs/topics/rate-limits
104+
* to ensure correct rate limiting according to:
105+
* https://discord.com/developers/docs/topics/rate-limits.
106106
*
107107
* @param string $url
108+
*
108109
* @return string
109110
*/
110-
protected function stripMinorParameters(string $url) : string
111+
protected function stripMinorParameters(string $url): string
111112
{
112113
$matches = [];
113114
if (
114115
(
115116
preg_match('/^(https:\/\/discord\.com\/api\/v\d+\/channels\/\d*).*?$/', $url, $matches) === 1 ||
116117
preg_match('/^(https:\/\/discord\.com\/api\/v\d+\/guilds\/\d*).*?$/', $url, $matches) === 1 ||
117-
preg_match('/^(https:\/\/discord\.com\/api\/v\d+\/users\/@me\/guilds\/\d*).*?$/', $url, $matches) === 1 ||
118+
preg_match('/^(https:\/\/discord\.com\/api\/v\d+\/users\/@me\/guilds\/\d*).*?$/', $url, $matches) === 1 ||
118119
preg_match('/^(https:\/\/discord\.com\/api\/v\d+\/webhooks\/\d*).*?$/', $url, $matches) === 1
119120
) && count($matches) === 2
120121
) {
121-
$url = $matches[1] . preg_replace('/[0-9]+/', '', substr($url, strlen($matches[1])));
122+
$url = $matches[1].preg_replace('/[0-9]+/', '', substr($url, strlen($matches[1])));
122123
}
123124

124125
return $url;
125126
}
126127
}
127-

src/RateLimit/RateLimiter.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,15 @@ public function __construct(AbstractRateLimitProvider $provider, array $options,
6565
*
6666
* @param callable $handler
6767
*
68-
* @return \Closure
6968
* @throws RatelimitException
69+
*
70+
* @return \Closure
7071
*/
7172
public function __invoke(callable $handler)
7273
{
7374
return function (RequestInterface $request, $options) use ($handler) {
7475
// Amount of time to delay the request by
75-
while(($delay = $this->getDelay($request)) > 0) {
76+
while (($delay = $this->getDelay($request)) > 0) {
7677
// Throw an exception if configured to do so, this will NOT delay the request and raise an Exception
7778
if ($this->options['throwOnRatelimit']) {
7879
throw new RatelimitException($request->getMethod().' '.$request->getUri());
@@ -216,4 +217,3 @@ protected function setAllowance(RequestInterface $request)
216217
};
217218
}
218219
}
219-

src/Traits/AvatarTrait.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public function getAvatar($format = 'webp', $size = null)
2828
$url = Constants::CDN_URL.'embed/avatars/'.($this->discriminator % 5).'.png';
2929

3030
// Check if User has Avatar
31-
if ($this->avatar)
32-
{
31+
if ($this->avatar) {
3332
if (strpos($this->avatar, 'a_') === 0) {
3433
$format = 'gif';
3534
}

tests/ServiceDescriptionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ServiceDescriptionTest extends TestCase
3434
*/
3535
public $client;
3636

37-
public function setUp():void
37+
public function setUp(): void
3838
{
3939
$this->description = json_decode(
4040
file_get_contents(__DIR__.'/../src/Resources/service_description-v6.json'),

0 commit comments

Comments
 (0)