summaryrefslogtreecommitdiffstats
path: root/Reaktor/IRC
diff options
context:
space:
mode:
authorEUcancER <root@euer.krebsco.de>2012-05-02 14:41:50 +0200
committerEUcancER <root@euer.krebsco.de>2012-05-02 14:41:50 +0200
commit4ea18af3e838f31afb2e5bb794652dde0a4ef127 (patch)
treed70b38567fd17c5274771c5c9bcf25323820a53f /Reaktor/IRC
parentfd50c8c919b53d7237179970224608c34075a12d (diff)
add line wrapping
as it seems to lose characters between 400 and 500 characters...
Diffstat (limited to 'Reaktor/IRC')
-rwxr-xr-xReaktor/IRC/asybot.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Reaktor/IRC/asybot.py b/Reaktor/IRC/asybot.py
index 6edc13ba..bf0c396f 100755
--- a/Reaktor/IRC/asybot.py
+++ b/Reaktor/IRC/asybot.py
@@ -16,7 +16,7 @@ import shlex
from time import sleep
from sys import exit
from re import split, search
-
+from textwrap import TextWrapper
import logging,logging.handlers
log = logging.getLogger('asybot')
hdlr = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON)
@@ -39,6 +39,7 @@ class asybot(asychat):
self.set_terminator('\r\n')
self.create_socket(AF_INET, SOCK_STREAM)
self.connect((self.server, self.port))
+ self.wrapper = TextWrapper(subsequent_indent=" ",width=400)
# When we don't receive data for alarm_timeout seconds then issue a
# PING every hammer_interval seconds until kill_timeout seconds have
@@ -107,9 +108,10 @@ class asybot(asychat):
def on_privmsg(self, prefix, command, params, rest):
def PRIVMSG(text):
- msg = 'PRIVMSG %s :%s' % (','.join(params), text)
- self.push(msg)
- sleep(1)
+ for line in self.wrapper.wrap(text):
+ msg = 'PRIVMSG %s :%s' % (','.join(params), line)
+ self.push(msg)
+ sleep(1)
def ME(text):
PRIVMSG('ACTION ' + text + '')