1
0
mirror of https://github.com/sys-fs/seddy synced 2024-11-26 04:57:18 -05:00

Sort out some bugs

This commit is contained in:
Thomas Mannay 2017-03-11 19:39:19 +00:00 committed by GitHub
parent 8cc04b7b9d
commit aea68aa4e4

View File

@ -1,6 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
# See the LICENSE file for licensing information # See the LICENSE file for licensing information
import re import re
from string import printable
nick = 'seddy' nick = 'seddy'
server = 'chat.freenode.net' server = 'chat.freenode.net'
@ -86,7 +87,8 @@ def notice(msg):
send.flush() send.flush()
def privmsg(msg): def privmsg(msg):
send.write('PRIVMSG ' + channel + ' :' + msg + '\r\n') send.write('PRIVMSG ' + channel + ' :' +
''.join(filter(printable.__contains__, msg)) + '\r\n')
send.flush() send.flush()
if __name__ == "__main__": if __name__ == "__main__":
@ -119,6 +121,6 @@ if __name__ == "__main__":
if '.source ' + nick in msg[:8 + len(nick)]: if '.source ' + nick in msg[:8 + len(nick)]:
notice('[Python] https://github.com/sys-fs/seddy') notice('[Python] https://github.com/sys-fs/seddy')
elif is_sed.match(msg): elif is_sed.match(msg):
foo = seddy(msg, history) foo = ''.join(c for c in seddy(msg, history) if c not in '\r\n')
if foo != False: if foo != False:
privmsg(re.sub('\\\\/', '/', foo)) privmsg(re.sub('\\\\/', '/', foo))