diff options
| author | Jakob L. Kreuze | 2023-03-11 19:33:53 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze | 2023-03-11 19:34:00 -0500 |
| commit | 6463a9f09032f22c8e39ccea757b8a7054f199ba (patch) | |
| tree | 38df169fa643db622c23959f077927e18dfc8f55 /haunt/jakob/dynamic/util.scm | |
| parent | 32e642f3789d163fae18824ec04e7e833713b26c (diff) | |
Guard against non-emoji reactions
Diffstat (limited to 'haunt/jakob/dynamic/util.scm')
| -rw-r--r-- | haunt/jakob/dynamic/util.scm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/haunt/jakob/dynamic/util.scm b/haunt/jakob/dynamic/util.scm index a7fd38d..92b2f25 100644 --- a/haunt/jakob/dynamic/util.scm +++ b/haunt/jakob/dynamic/util.scm @@ -82,3 +82,24 @@ If KEY does not exist in TABLE, initialize kEY to (list ITEM)" (if (hash-ref table key) (hash-set! table key (cons item (hash-ref table key))) (hash-set! table key (list item)))) + +(define (emoji? str) + "Determine if `str' is an 'acceptable' emoji character + +Acceptable is the following subset: + +- The 'Emoticons' block +- The 'Supplemental Symbols and Pictographs' block, excluding U+1F900 + through U+1F90B +- The hand symbols from the 'Miscellaneous Symbols and Pictographs' + block +- The hand symbols from the 'Dingbats' block + +Notably, U+1F946 isn't normally treated an emoji, but it is here. I +think it should be! As an American, I should be able to use pictographs +to express my God-given constitutional rights!" + (and (string str) + (= 1 (string-length str)) + (let ((codepoint (char->integer + (first (string->list str))))) + (and (>= codepoint #x1F600) (<= codepoint #x1F64F))))) |