]> git.sesse.net Git - skvidarsync/commitdiff
Don't match dates in channel names.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 11 Feb 2024 19:52:09 +0000 (20:52 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 11 Feb 2024 19:52:09 +0000 (20:52 +0100)
bin/ws.pl

index f3dd7bc77cf8b617ba6769ff2e35416661836dcb..dd6a0ae65eb59257171cfd1365671143d3db6352 100644 (file)
--- a/bin/ws.pl
+++ b/bin/ws.pl
@@ -117,7 +117,9 @@ sub handle_event {
        my $user = $ev->{'user'};
 
        if ($type eq 'message') {
-               if ($ev->{'text'} =~ /(20\d{2}-\d{2}-\d{2})/ || $ev->{'message'}{'text'} =~ /(20\d{2}-\d{2}-\d{2})/) {
+               my $text = $ev->{'text'} // $ev->{'message'}{'text'};
+               $text =~ s/<#[A-Z0-9]+|[^>]+>//g; #  Don't match dates in channel names.
+               if ($text =~ /(20\d{2}-\d{2}-\d{2})/) {
                        # TODO: What if edits happen out-of-order?
                        my $date = $1;
                        my $channel = $ev->{'channel'};