Encyclopedia: Refactor handling of being addressed.
This commit is contained in:
parent
83434d4373
commit
1284f0c157
|
@ -24,8 +24,8 @@ import supybot
|
||||||
import supybot.world as world
|
import supybot.world as world
|
||||||
from imp import reload
|
from imp import reload
|
||||||
|
|
||||||
__version__ = "3.1"
|
__version__ = "3.2"
|
||||||
__author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@tuxgarage.com")
|
__author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@gmail.com")
|
||||||
__contributors__ = {
|
__contributors__ = {
|
||||||
supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'],
|
supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'],
|
||||||
supybot.Author("Terence Simpson", "tsimpson", "tsimpson@ubuntu.com"): ['Original Author']
|
supybot.Author("Terence Simpson", "tsimpson", "tsimpson@ubuntu.com"): ['Original Author']
|
||||||
|
|
|
@ -427,9 +427,11 @@ class Encyclopedia(callbacks.Plugin):
|
||||||
if c.isCommandMethod(cmd):
|
if c.isCommandMethod(cmd):
|
||||||
return
|
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)
|
prefixchar = self.registryValue('prefixchar', channel)
|
||||||
if match:
|
if text[0] == prefixchar:
|
||||||
text = match.group('text')
|
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:
|
elif channel:
|
||||||
return
|
return
|
||||||
if not text:
|
if not text:
|
||||||
|
|
Loading…
Reference in New Issue