From 74efcd0f6661645490606be8588b52f0eb6b0dd2 Mon Sep 17 00:00:00 2001 From: Thomas Mannay Date: Mon, 13 Mar 2017 13:37:16 +0000 Subject: [PATCH] Change method for stripping non-printable chars. --- seddy.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/seddy.py b/seddy.py index be925c2..5a3370e 100644 --- a/seddy.py +++ b/seddy.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # See the LICENSE file for licensing information import re -from string import printable nick = 'seddy' server = 'chat.freenode.net' @@ -88,7 +87,7 @@ def notice(msg): def privmsg(msg): send.write('PRIVMSG ' + channel + ' :' + - ''.join(filter(printable.__contains__, msg)) + '\r\n') + ''.join(c for c in msg if c.isprintable()) + '\r\n') send.flush() if __name__ == "__main__": @@ -122,6 +121,5 @@ if __name__ == "__main__": notice('[Python] https://github.com/sys-fs/seddy') elif is_sed.match(msg): foo = seddy(msg,history) - foo = ''.join(c for c in foo if c not in '\r\n') if foo != False: privmsg(re.sub('\\\\/', '/', foo))