Skip to content

Commit

Permalink
Debug QuitTransport
Browse files Browse the repository at this point in the history
  • Loading branch information
Korbeil committed May 17, 2024
1 parent f68e83d commit 4b9707f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/Discord/Command/Helper/UserHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Afup\Hermes\Discord\Command\Helper;

use Afup\Hermes\Entity\User;
use Afup\Hermes\Repository\User\FindOrCreateUserDebug;
use Discord\Builders\MessageBuilder;
use Discord\Parts\Interactions\Interaction;
use Discord\Parts\User\User as DiscordUser;

Expand Down
5 changes: 5 additions & 0 deletions app/src/Discord/Command/QuitTransportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Afup\Hermes\Repository\Event\FindEventByChannel;
use Afup\Hermes\Repository\Traveler\GetTravelerListForUserAndEvent;
use Afup\Hermes\Repository\User\FindOrCreateUser;
use Afup\Hermes\Repository\User\FindOrCreateUserDebug;
use Discord\Builders\CommandBuilder;
use Discord\Builders\Components\ActionRow;
use Discord\Builders\Components\Button;
Expand Down Expand Up @@ -96,9 +97,11 @@ public function callback(Discord $discord): void

private function validateRemoval(Discord $discord, Interaction $interaction, Traveler $traveler): void
{
$interaction->channel->sendMessage(MessageBuilder::new()->setContent('A'));

Check failure on line 100 in app/src/Discord/Command/QuitTransportCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Cannot call method sendMessage() on Discord\Parts\Channel\Channel|null.
$embed = new Embed($discord);
$embed->setTitle($this->translator->trans('discord.quit_transport.confirmation'));

$interaction->channel->sendMessage(MessageBuilder::new()->setContent('B'));

Check failure on line 104 in app/src/Discord/Command/QuitTransportCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Cannot call method sendMessage() on Discord\Parts\Channel\Channel|null.
$validation = ActionRow::new()
->addComponent(Button::new(Button::STYLE_DANGER)->setLabel($this->translator->trans('discord.quit_transport.confirm_button'))->setEmoji('🗑️')->setListener(function (Interaction $interaction) use ($traveler, $discord): void {
$transport = $traveler->transport;
Expand All @@ -116,6 +119,8 @@ private function validateRemoval(Discord $discord, Interaction $interaction, Tra
$interaction->updateMessage(MessageBuilder::new()->setContent($this->translator->trans('discord.quit_transport.cancel_label'))->setComponents([])->setEmbeds([]));
}, $discord));

$interaction->channel->sendMessage(MessageBuilder::new()->setContent('C'));

Check failure on line 122 in app/src/Discord/Command/QuitTransportCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Cannot call method sendMessage() on Discord\Parts\Channel\Channel|null.
$interaction->updateMessage(MessageBuilder::new()->addEmbed($embed)->addComponent($validation));
$interaction->channel->sendMessage(MessageBuilder::new()->setContent('D'));

Check failure on line 124 in app/src/Discord/Command/QuitTransportCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Cannot call method sendMessage() on Discord\Parts\Channel\Channel|null.
}
}
2 changes: 2 additions & 0 deletions app/src/Repository/User/FindOrCreateUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Afup\Hermes\Repository\User;

use Afup\Hermes\Entity\User;
use Discord\Builders\MessageBuilder;
use Discord\Parts\Interactions\Interaction;
use Doctrine\ORM\EntityManagerInterface;

final readonly class FindOrCreateUser
Expand Down

0 comments on commit 4b9707f

Please sign in to comment.