Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
David A indivisible-irl authored

Showing 1 changed file with 9 additions and 9 deletions. Show diff stats Hide diff stats

  1. +9 9 core.py
18 core.py
... ... @@ -1,4 +1,4 @@
1   -import socket, re, time
  1 +import socket, re
2 2
3 3 from commandModule import CommandModule
4 4 from behaviourModule import BehaviourModule
@@ -21,7 +21,7 @@ def __init__(self, tempCacheSize=4096):
21 21 self.commandModule = CommandModule()
22 22
23 23 self.regexIsCommand = re.compile(r"(?P<command>!!..+)")
24   - self.regexIsChat = re.compile(r":(?P<user>\w+)!~(?P<isp>.+)\sPRIVMSG\s(?P<channel>[\w#]+)\s:(?P<message>.+)")
  24 + self.regexIsChat = re.compile(r":(?P<user>\w+)!~(?P<isp>.+)\sPRIVMSG\s(?P<channel>[#\w-]+)\s:(?P<message>.+)")
25 25
26 26 def run(self):
27 27 self.socket.connect((self.network, self.port))
@@ -37,10 +37,10 @@ def run(self):
37 37
38 38 def mainLoop(self):
39 39 while True:
40   - recievedData = self.socket.recv(self.tempCacheSize)
  40 + receivedData = self.socket.recv(self.tempCacheSize)
41 41 #self.log(recievedData)
42 42 messageInfo = dict()
43   - isChat = self.regexIsChat.match(recievedData)
  43 + isChat = self.regexIsChat.match(receivedData)
44 44 if isChat:
45 45 messageInfo['user'] = isChat.group('user')
46 46 messageInfo['isp'] = isChat.group('isp')
@@ -51,20 +51,20 @@ def mainLoop(self):
51 51 if isCommand:
52 52 self.commandModule.runCommand(isCommand.group('command'), messageInfo)
53 53
54   - self.behaviourModule.performBehaviours(recievedData)
  54 + self.behaviourModule.performBehaviours(receivedData)
55 55
56 56 #temporary quit method, should be changed so only admins can use
57   - if recievedData.find('!!quit') != -1:
  57 + if receivedData.find('!!quit') != -1:
58 58 self.log("Quitting")
59 59 self.socket.send('QUIT\r\n')
60 60 break
61 61
62 62 #make sure we don't time out of server
63   - if recievedData.find('PING') != -1:
64   - self.socket.send('PONG %s \r\n' % recievedData.split()[1])
  63 + if receivedData.find('PING') != -1:
  64 + self.socket.send('PONG %s \r\n' % receivedData.split()[1])
65 65 else:
66 66 # moved log here to filter out ping/pong chatter
67   - self.log(recievedData)
  67 + self.log(receivedData)
68 68
69 69 def log(self, stringToLog):
70 70 #change eventually to log in a file but for now print is fine

0 comments on commit 582d9ea

Please sign in to comment.
Something went wrong with that request. Please try again.