add support for direct messages
parent
a59fcf0adb
commit
92d925613f
12
main.py
12
main.py
|
@ -297,7 +297,14 @@ class IRCBot():
|
|||
channel_search = channel_re.search(line)
|
||||
if not channel_search:
|
||||
continue
|
||||
name_search = name_re.search(line)
|
||||
channel = channel_search.group(1)
|
||||
if name_search:
|
||||
name = name_search.group(1)
|
||||
else:
|
||||
name = None
|
||||
if name and not channel.startswith("#"):
|
||||
channel = name
|
||||
try:
|
||||
message_body = line[line.index(" :") + 2:]
|
||||
except Exception as e:
|
||||
|
@ -307,11 +314,6 @@ class IRCBot():
|
|||
self.send(channel, self.helptext)
|
||||
continue
|
||||
for command, callback in self.commands:
|
||||
name_search = name_re.search(line)
|
||||
if name_search:
|
||||
name = name_search.group(1)
|
||||
else:
|
||||
name = None
|
||||
if line.lower().endswith(command):
|
||||
result = callback(channel, name)
|
||||
if result:
|
||||
|
|
Loading…
Reference in New Issue