Customize the new comment notifications sent to the post author after the comment is approved

Initially it seemed like a good idea to add comment_notification_text inside the pre_comment_on_post hook, but it didn’t go well. So I removed the pre_comment_on_post and just added to comment_notification_text a comment type check, which is related to the CPT for which the comments are. Now my code works fine for both comment categories (moderated and not).

add_filter( 'comment_notification_text', function( $notify_message, $comment_id ) {
    if( 'message' !== get_comment_type( $comment_id ) ) { return $notify_message; }

    // the rest of the code

    return $message;
}, 10, 2 );