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