Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed bug where bot couldn't handle channels with hyphens in the name…

…, also typos in core.py
  • Loading branch information...
commit 582d9eabc096127cc381923d8452c74f5ce99c4e 1 parent f0b2b06
@indivisible-irl indivisible-irl authored
Showing with 9 additions and 9 deletions.
  1. +9 −9 core.py
View
18 core.py
@@ -1,4 +1,4 @@
-import socket, re, time
+import socket, re
from commandModule import CommandModule
from behaviourModule import BehaviourModule
@@ -21,7 +21,7 @@ def __init__(self, tempCacheSize=4096):
self.commandModule = CommandModule()
self.regexIsCommand = re.compile(r"(?P<command>!!..+)")
- self.regexIsChat = re.compile(r":(?P<user>\w+)!~(?P<isp>.+)\sPRIVMSG\s(?P<channel>[\w#]+)\s:(?P<message>.+)")
+ self.regexIsChat = re.compile(r":(?P<user>\w+)!~(?P<isp>.+)\sPRIVMSG\s(?P<channel>[#\w-]+)\s:(?P<message>.+)")
def run(self):
self.socket.connect((self.network, self.port))
@@ -37,10 +37,10 @@ def run(self):
def mainLoop(self):
while True:
- recievedData = self.socket.recv(self.tempCacheSize)
+ receivedData = self.socket.recv(self.tempCacheSize)
#self.log(recievedData)
messageInfo = dict()
- isChat = self.regexIsChat.match(recievedData)
+ isChat = self.regexIsChat.match(receivedData)
if isChat:
messageInfo['user'] = isChat.group('user')
messageInfo['isp'] = isChat.group('isp')
@@ -51,20 +51,20 @@ def mainLoop(self):
if isCommand:
self.commandModule.runCommand(isCommand.group('command'), messageInfo)
- self.behaviourModule.performBehaviours(recievedData)
+ self.behaviourModule.performBehaviours(receivedData)
#temporary quit method, should be changed so only admins can use
- if recievedData.find('!!quit') != -1:
+ if receivedData.find('!!quit') != -1:
self.log("Quitting")
self.socket.send('QUIT\r\n')
break
#make sure we don't time out of server
- if recievedData.find('PING') != -1:
- self.socket.send('PONG %s \r\n' % recievedData.split()[1])
+ if receivedData.find('PING') != -1:
+ self.socket.send('PONG %s \r\n' % receivedData.split()[1])
else:
# moved log here to filter out ping/pong chatter
- self.log(recievedData)
+ self.log(receivedData)
def log(self, stringToLog):
#change eventually to log in a file but for now print is fine
Please sign in to comment.
Something went wrong with that request. Please try again.