From e82c66e22bdff6df215b5d5d1a32d2eb53dc244b Mon Sep 17 00:00:00 2001 From: xfnw Date: Tue, 3 Aug 2021 20:45:16 -0400 Subject: [PATCH] remove trailing \1 if message does not start with \1 (fixes #1) --- modules/nlp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/nlp.py b/modules/nlp.py index ba2418f..51b52a3 100644 --- a/modules/nlp.py +++ b/modules/nlp.py @@ -95,7 +95,10 @@ async def go(self, c, n, m): words = re.sub(r'([\.,\?!])', r' \1', m).split() if words[0] == 'admin': return - await self.message(c, re.sub(r' ([\.,\?!])', r'\1', ' '.join(await genOut(self, await getNoun(self, words, c))))) + msg = re.sub(r' ([\.,\?!])', r'\1', ' '.join(await genOut(self, await getNoun(self, words, c)))) + if msg[-1] == "\x01" and msg[0] != "\x01": + msg = msg[:-1] + await self.message(c, msg) async def init(self): @@ -108,7 +111,7 @@ async def init(self): # sentance ending weight, lower means longer sentances, # higher means shorter sentances. this will need to slowly # get larger as the database grows - shared.enmul = 6 + shared.enmul = 10 shared.rawm['nlp'] = filter