]> git.aero2k.de Git - urlbot-v3.git/commitdiff
fix routing key (again?!)
authorThorsten <mail@aero2k.de>
Mon, 8 Mar 2021 21:36:03 +0000 (22:36 +0100)
committerThorsten <mail@aero2k.de>
Mon, 8 Mar 2021 21:36:03 +0000 (22:36 +0100)
distbot/bot/bot.py
distbot/plugins/translation.py

index 8d1c42eb9cc2994db311378cf8bdc6454ed7a34d..009a397fb6c0f581f6e9c8961d287cb047dfa908 100644 (file)
@@ -103,7 +103,7 @@ class Bot(slixmpp.ClientXMPP):
     def get_amqp_routing_key(nick, msg):
         # simplify the key significantly
         offset = 0
-        key = shlex.split(re.sub(r'[^a-zäöüß0-9 "\'.]', '', msg["body"].lower()))
+        key = shlex.split(re.sub(r'[^a-zäöüß0-9 "\'.-]', '', msg["body"].lower()))
         if not key:
             # simple dots, smilies, emoji shit, pass through
             key = shlex.split(msg["body"].lower())
index a3c2d2d7a30a4b01774f136dc290abd0e0e66b4e..69f8469a0f48d76979df862846128a3df3221ca2 100644 (file)
@@ -521,6 +521,7 @@ class Translator(Worker):
                 }
                 result = requests.post('http://ws.detectlanguage.com/0.2/detect', data=data).json()
                 educated_guess = result['data']['detections'][0]
+                logger.info("detected language: %s", str(educated_guess))
                 if not educated_guess['isReliable']:
                     return Action(msg='not sure about the language.')
                 else: