Skip to content

Commit

Permalink
Add docs and safeguard
Browse files Browse the repository at this point in the history
  • Loading branch information
HazAT committed Nov 27, 2024
1 parent ceaa6df commit 13d5aad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Event/LinkSharedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,18 @@ public function process(): void
}
}

/**
* Fetch a Discord message
*
* @param string $url The Discord message URL
* @return string The message content
*/
private function fetchDiscordMessage(string $url): string
{
if (!preg_match('#^https://discord\.com/channels/\d+/\d+/\d+$#', $url)) {
return $url;
}

$parts = explode('/', $url);
$channelId = $parts[5];
$messageId = $parts[6];
Expand Down

0 comments on commit 13d5aad

Please sign in to comment.