Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit 57f1828

Browse files
committed
fixed workaround
1 parent 91170d2 commit 57f1828

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

src/Discord/Client.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ public function handleRequest(ServerRequestInterface $request)
213213
return $this->handleInteraction($interaction)->then(function ($result) {
214214
$this->logger->info('responding to interaction', $result);
215215

216-
header('Content-Type: application/json');
217216
return new Response(Response::STATUS_OK, ['Content-Type' => 'application/json'], json_encode($result));
218217
});
219218
}
@@ -251,23 +250,17 @@ private function handleApplicationCommand(Interaction $interaction): void
251250
$checkCommand = function ($command) use ($interaction, &$checkCommand) {
252251
if (isset($this->commands[$command['name']])) {
253252
if ($this->commands[$command['name']]->execute($command['options'] ?? [], $interaction)) {
254-
$this->logger->info('executing command', $command);
255253
return true;
256254
}
257255
}
258256

259257
foreach ($command['options'] ?? [] as $option) {
260258
if ($checkCommand($option)) {
261-
$this->logger->info('executing option', $command);
262259
return true;
263260
}
264261
}
265-
266-
$this->logger->info('done finding command', $command);
267262
};
268263

269-
$this->logger->info('finding command', $interaction->data);
270-
271264
$checkCommand($interaction->data);
272265
}
273266

@@ -320,6 +313,7 @@ public function runCgi()
320313
$serverRequest = (new \Kambo\Http\Message\Factories\Environment\ServerRequestFactory())->create($environment);
321314

322315
$this->handleRequest($serverRequest)->then(function (Response $response) {
316+
header('Content-Type: application/json'); // Workaround
323317
http_response_code($response->getStatusCode());
324318
echo (string) $response->getBody();
325319
});

src/Discord/Parts/RegisteredCommand.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ public function execute(array $options, Interaction $interaction): bool
7777
}
7878

7979
if (! is_null($this->callback)) {
80-
error_log('calling command callback');
8180
($this->callback)($interaction, new Choices($options));
82-
error_log('called command callback');
8381

8482
return true;
8583
}

0 commit comments

Comments
 (0)