--- /dev/null
+<?php
+
+namespace App\DiscordBotCommands;
+
+use App\Models\DiscordBotCommand;
+use Discord\Discord;
+use Discord\Parts\Channel\Channel;
+use Discord\Parts\Channel\Message;
+use Discord\Parts\User\Member;
+
+class ResultCommand extends BaseCommand {
+
+ public function __construct(Discord $discord, DiscordBotCommand $cmd) {
+ parent::__construct($discord, $cmd);
+ }
+
+ public function execute() {
+ if (!$this->hasRoundChannels()) {
+ return \React\Promise\resolve();
+ }
+ return $this->fetchRoundChannel()
+ ->then(function (Channel $channel) {
+ return $this->fetchMember();
+ })
+ ->then(function (Member $member) {
+ return $this->roundChannel->setPermissions($member, [
+ 'view_channel',
+ ]);
+ })
+ ->then(function () {
+ $user = $this->getUser();
+ $round = $this->getRound();
+ $result = $user->findResult($round);
+ $msg = '';
+ if (!$result || $result->forfeit) {
+ $msg = __('discord_commands.result.forfeit', ['name' => $user->getName()]);
+ } else {
+ $msg = __('discord_commands.result.finish', ['name' => $user->getName(), 'time' => $result->formatTime()]);
+ }
+ return $this->roundChannel->sendMessage($msg);
+ });
+ }
+
+}