Updated event regexes

This commit is contained in:
mrhanky 2017-05-28 14:07:35 +02:00
parent 95e89535cc
commit 2f81127f23
No known key found for this signature in database
GPG Key ID: 67D772C481CB41B8

View File

@ -26,21 +26,21 @@ GNU_LINUX = """I'd Just Like To Interject For A Moment. What you're referring
class Useless(Plugin):
requires = ['irc3.plugins.command']
@event(r'(?i)^:.* PRIVMSG (?P<channel>.*) :'
@event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :'
r'.*(?<!gnu[/+])linux(?! kernel).*')
def linux(self, channel: str):
if random.randint(0, 4) is 0:
self.bot.privmsg(channel, GNU_LINUX)
@event(r'(?i)^:.* PRIVMSG (?P<channel>.*) :(?P<data>huehuehue)$')
def huehuehue(self, channel: str, data: str):
self.bot.privmsg(channel, data)
@event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :(?P<msg>huehuehue)$')
def huehuehue(self, channel: str, msg: str):
self.bot.privmsg(channel, msg)
@event(r'(?i)^:.* PRIVMSG (?P<channel>.*) :same$')
@event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :same$')
def same(self, channel: str):
self.bot.privmsg(channel, 'same')
@event(r'(?i)^:.* PRIVMSG (?P<channel>.*) :\[(?P<data>.*)\]$')
@event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :\[(?P<data>.*)\]$')
def intensifies(self, channel: str, data: str):
self.bot.privmsg(channel, fmt('{bold}[{data} INTENSIFIES]',
data=data.upper()))
@ -48,7 +48,7 @@ class Useless(Plugin):
@command
def storyofpomfface(self, mask: IrcString, channel: IrcString,
args: DocOptDict):
"""Story of pomf face
"""Story of pomf face.
%%storyofpomfface
"""
@ -57,7 +57,7 @@ class Useless(Plugin):
@command
def jn(self, mask: IrcString, channel: IrcString, args: DocOptDict):
"""Decides between yes and no (for a question)
"""Decides between yes and no (for a question).
%%jn <question>
%%jn
@ -67,7 +67,7 @@ class Useless(Plugin):
@command
def kiss(self, mask: IrcString, channel: IrcString, args: DocOptDict):
"""Kisses a user
"""Kisses a user.
%%kiss <nick>
"""
@ -77,7 +77,7 @@ class Useless(Plugin):
@command
def hug(self, mask: IrcString, channel: IrcString,
args: DocOptDict) -> str:
"""Hugs a user
"""Hugs a user.
%%hug <nick>
"""
@ -86,14 +86,12 @@ class Useless(Plugin):
@command
def hack(self, mask: IrcString, channel: IrcString, args: DocOptDict):
"""Hacks (a user)
"""Hacks (a user).
%%hack [<nick>]
"""
nick = args.get('<nick>') or ''
if nick:
nick = ' {nick}'.format(nick=nick)
return 'hacking{nick}...'.format(nick=nick)
return 'hacking{}...'.format(' %s' % nick if nick else '')
@command
def gay(self, mask: IrcString, channel: IrcString, args: DocOptDict):
@ -105,7 +103,7 @@ class Useless(Plugin):
@command
def rainbow(self, mask: IrcString, channel: IrcString, args: DocOptDict):
"""Colorize a word in rainbow colors
"""Colorize a word in rainbow colors.
%%rainbow <word>...
"""
@ -120,7 +118,7 @@ class Useless(Plugin):
@command
def wrainbow(self, mask: IrcString, channel: IrcString, args: DocOptDict):
"""Colorize words in a sentence with rainbow colors
"""Colorize words in a sentence with rainbow colors.
%%wrainbow <words>...
"""