Encyclopedia: Refactor handling of being addressed.
This commit is contained in:
@ -24,8 +24,8 @@ import supybot
|
||||
import supybot.world as world
|
||||
from imp import reload
|
||||
|
||||
__version__ = "3.1"
|
||||
__author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@tuxgarage.com")
|
||||
__version__ = "3.2"
|
||||
__author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@gmail.com")
|
||||
__contributors__ = {
|
||||
supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'],
|
||||
supybot.Author("Terence Simpson", "tsimpson", "tsimpson@ubuntu.com"): ['Original Author']
|
||||
|
@ -427,9 +427,11 @@ class Encyclopedia(callbacks.Plugin):
|
||||
if c.isCommandMethod(cmd):
|
||||
return
|
||||
|
||||
match = re.match(r'^(?:%s|%s[\W\s]+)\s*(?P<text>.*?)$' % (re.escape(self.registryValue('prefixchar', channel)), re.escape(irc.nick)), text, re.I)
|
||||
if match:
|
||||
text = match.group('text')
|
||||
prefixchar = self.registryValue('prefixchar', channel)
|
||||
if text[0] == prefixchar:
|
||||
text = text[1:].strip()
|
||||
elif re.match(r'^%s[\W\s]' % re.escape(irc.nick), text, re.I):
|
||||
text = re.sub(r'^%s[\W\s]\s*%s?\s*' % (re.escape(irc.nick), re.escape(prefixchar)), '', text, flags=re.I)
|
||||
elif channel:
|
||||
return
|
||||
if not text:
|
||||
|
Reference in New Issue
Block a user