#lang racket/base (require irc/command racket/sequence racket/function racket/format) (provide (all-defined-out)) (define (short-arg? v) (or (string? v) (symbol? v) (number? v))) (define (ensure-all-short v) (unless (andmap short-arg? v) (error-user "You may only supply short (string, symbol, number) arguments"))) (define (stringify v) (cond [(string? v) (clean-control v)] [(symbol? v) (clean-control (symbol->string v))] [(number? v) (~a v)] [else ""])) (define (clean-control s) (list->string (sequence->list (sequence-filter (negate char-iso-control?) (in-string s))))) ; insert zero-width space to prevent clients from notifying a user (define (break-highlight s) (if (zero? (string-length s)) s (string-append (substring s 0 1) "\u200B" (substring s 1))))