From a0ae90710e0492621a7325898f177223a982f27a Mon Sep 17 00:00:00 2001 From: Aleks-Daniel Jakimenko-Aleksejev Date: Fri, 16 Aug 2019 20:47:21 +0300 Subject: [PATCH] Renormalize nicknames on startup Should improve the bus factor a bit, assuming that nothing goes wrong with these few lines. --- xbin/Tellable.p6 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xbin/Tellable.p6 b/xbin/Tellable.p6 index 909ac6d..08c49ce 100755 --- a/xbin/Tellable.p6 +++ b/xbin/Tellable.p6 @@ -142,6 +142,16 @@ multi method irc-to-me($msg where { m:r/^ \s* [[to|tell|ask] \s+]? my %*BOT-ENV = %(); +{ + # Renormalize on startup in case the rules were updated + $db-tell.write: $db-tell.read.values».list.flat.classify: { + normalize-weirdly . + }; + $db-seen.write: %($db-seen.read.values.map: { + normalize-weirdly(.) => $_ + }); +} + Tellable.new.selfrun: ‘tellable6’, [/ [to|tell|ask|seen] 6? /, fuzzy-nick(‘tellable6’, 1)];