mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Added --without.
This commit is contained in:
parent
4dd07b1690
commit
d253d7e1bf
@ -153,14 +153,15 @@ class URL(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
stats = wrap(stats, ['channeldb'])
|
stats = wrap(stats, ['channeldb'])
|
||||||
|
|
||||||
def last(self, irc, msg, args, optlist, channel):
|
def last(self, irc, msg, args, optlist, channel):
|
||||||
"""[<channel>] [--{from,with,near,proto}=<value>] --nolimit
|
"""[<channel>] [--{from,with,without,near,proto}=<value>] --nolimit
|
||||||
|
|
||||||
Gives the last URL matching the given criteria. --from is from whom
|
Gives the last URL matching the given criteria. --from is from whom
|
||||||
the URL came; --proto is the protocol the URL used; --with is something
|
the URL came; --proto is the protocol the URL used; --with is something
|
||||||
inside the URL; --near is something in the same message as the URL; If
|
inside the URL; --without is something that should not be in the URL;
|
||||||
--nolimit is given, returns all the URLs that are found. to just the
|
--near is something in the same message as the URL; If --nolimit is
|
||||||
URL. <channel> is only necessary if the message isn't sent in the
|
given, returns all the URLs that are found. to just the URL.
|
||||||
channel itself.
|
<channel> is only necessary if the message isn't sent in the channel
|
||||||
|
itself.
|
||||||
"""
|
"""
|
||||||
predicates = []
|
predicates = []
|
||||||
f = None
|
f = None
|
||||||
@ -174,6 +175,9 @@ class URL(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
elif option == 'with':
|
elif option == 'with':
|
||||||
def f(record, arg=arg):
|
def f(record, arg=arg):
|
||||||
return arg in record.url
|
return arg in record.url
|
||||||
|
elif option == 'without':
|
||||||
|
def f(record, arg=arg):
|
||||||
|
return arg not in record.url
|
||||||
elif option == 'proto':
|
elif option == 'proto':
|
||||||
def f(record, arg=arg):
|
def f(record, arg=arg):
|
||||||
return record.url.startswith(arg)
|
return record.url.startswith(arg)
|
||||||
@ -202,7 +206,8 @@ class URL(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
'with': 'text',
|
'with': 'text',
|
||||||
'near': 'text',
|
'near': 'text',
|
||||||
'proto': 'text',
|
'proto': 'text',
|
||||||
'nolimit': '',})
|
'nolimit': '',
|
||||||
|
'without': 'text',})
|
||||||
|
|
||||||
|
|
||||||
Class = URL
|
Class = URL
|
||||||
|
@ -73,6 +73,7 @@ class URLTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
re.escape(urls[-1]))
|
re.escape(urls[-1]))
|
||||||
self.assertRegexp('url last --with dhcp', re.escape(urls[-3]))
|
self.assertRegexp('url last --with dhcp', re.escape(urls[-3]))
|
||||||
self.assertRegexp('url last --from alsdkjf', '^No')
|
self.assertRegexp('url last --from alsdkjf', '^No')
|
||||||
|
self.assertRegexp('url last --without game', 'sourceforge')
|
||||||
#self.assertNotError('url random')
|
#self.assertNotError('url random')
|
||||||
|
|
||||||
def testDefaultNotFancy(self):
|
def testDefaultNotFancy(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user