Skip to content

Commit

Permalink
feat(command-handler): removing leading slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
AIPTU committed Aug 20, 2024
1 parent 2487c50 commit a4ac7fb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/aiptu/smaccer/entity/command/CommandHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public function edit(int $id, string $newCommand, string $newType) : bool {
return false;
}

if (str_starts_with($newCommand, '/')) {
$newCommand = substr($newCommand, 1);
}

$existingId = $this->getIdByCommandAndType($newCommand, $newType);
if ($existingId !== null && $existingId !== $id) {
return false;
Expand Down

0 comments on commit a4ac7fb

Please sign in to comment.