switch readme to markdown, fix ping timeouts
parent
800b78a02f
commit
67ef6a0afe
|
@ -0,0 +1,20 @@
|
||||||
|
phenny
|
||||||
|
======
|
||||||
|
|
||||||
|
Warning
|
||||||
|
-------
|
||||||
|
This is an experimental port of phenny to python3. Do not expect it to work at
|
||||||
|
all.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
1. Run ./phenny - this creates a default config file
|
||||||
|
2. Edit ~/.phenny/default.py
|
||||||
|
3. Run ./phenny - this now runs phenny with your settings
|
||||||
|
|
||||||
|
Enjoy!
|
||||||
|
|
||||||
|
--
|
||||||
|
Sean B. Palmer, http://inamidst.com/sbp/
|
||||||
|
mutantmonkey, http://mutantmonkey.in
|
10
README.txt
10
README.txt
|
@ -1,10 +0,0 @@
|
||||||
Installation &c.
|
|
||||||
|
|
||||||
1) Run ./phenny - this creates a default config file
|
|
||||||
2) Edit ~/.phenny/default.py
|
|
||||||
3) Run ./phenny - this now runs phenny with your settings
|
|
||||||
|
|
||||||
Enjoy!
|
|
||||||
|
|
||||||
--
|
|
||||||
Sean B. Palmer, http://inamidst.com/sbp/
|
|
15
irc.py
15
irc.py
|
@ -52,7 +52,6 @@ class Bot(asynchat.async_chat):
|
||||||
|
|
||||||
def __write(self, args, text=None):
|
def __write(self, args, text=None):
|
||||||
# print '%r %r %r' % (self, args, text)
|
# print '%r %r %r' % (self, args, text)
|
||||||
print(args, text)
|
|
||||||
try:
|
try:
|
||||||
if text is not None:
|
if text is not None:
|
||||||
self.push((b' '.join(args) + b' :' + text)[:512] + b'\r\n')
|
self.push((b' '.join(args) + b' :' + text)[:512] + b'\r\n')
|
||||||
|
@ -64,16 +63,20 @@ class Bot(asynchat.async_chat):
|
||||||
def write(self, args, text=None):
|
def write(self, args, text=None):
|
||||||
"""This is a safe version of __write"""
|
"""This is a safe version of __write"""
|
||||||
def safe(input):
|
def safe(input):
|
||||||
input = input.replace('\n', '')
|
if type(input) == str:
|
||||||
input = input.replace('\r', '')
|
input = input.replace('\n', '')
|
||||||
return input.encode('utf-8')
|
input = input.replace('\r', '')
|
||||||
|
return input.encode('utf-8')
|
||||||
|
else:
|
||||||
|
return input
|
||||||
try:
|
try:
|
||||||
args = [safe(arg) for arg in args]
|
args = [safe(arg) for arg in args]
|
||||||
if text is not None:
|
if text is not None:
|
||||||
text = safe(text)
|
text = safe(text)
|
||||||
self.__write(args, text)
|
self.__write(args, text)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
raise
|
||||||
|
#pass
|
||||||
|
|
||||||
def run(self, host, port=6667, ssl=False, ipv6=False):
|
def run(self, host, port=6667, ssl=False, ipv6=False):
|
||||||
self.initiate_connect(host, port, ssl, ipv6)
|
self.initiate_connect(host, port, ssl, ipv6)
|
||||||
|
@ -118,12 +121,10 @@ class Bot(asynchat.async_chat):
|
||||||
|
|
||||||
def found_terminator(self):
|
def found_terminator(self):
|
||||||
line = self.buffer
|
line = self.buffer
|
||||||
print(line)
|
|
||||||
if line.endswith(b'\r'):
|
if line.endswith(b'\r'):
|
||||||
line = line[:-1]
|
line = line[:-1]
|
||||||
self.buffer = b''
|
self.buffer = b''
|
||||||
|
|
||||||
# print line
|
|
||||||
if line.startswith(b':'):
|
if line.startswith(b':'):
|
||||||
source, line = line[1:].split(b' ', 1)
|
source, line = line[1:].split(b' ', 1)
|
||||||
else: source = None
|
else: source = None
|
||||||
|
|
Loading…
Reference in New Issue