remove broken .quotedelete
This commit is contained in:
parent
2171ebd72f
commit
4ea7cb5a46
|
@ -95,48 +95,3 @@ def quote(inp, nick='', chan='', db=None):
|
||||||
selected_quote = quotes[num - 1]
|
selected_quote = quotes[num - 1]
|
||||||
|
|
||||||
return format_quote(selected_quote, num, n_quotes)
|
return format_quote(selected_quote, num, n_quotes)
|
||||||
|
|
||||||
|
|
||||||
@hook.command('qdel', adminonly=True)
|
|
||||||
@hook.command
|
|
||||||
def quotedelete:
|
|
||||||
".qdel/.quotedelete [#chan] [nick] <#n>/.quote add <nick> <msg> -- deletes " \
|
|
||||||
"<#n>th quote by <nick> or from <#chan> (adminonly)"
|
|
||||||
|
|
||||||
retrieve = re.match(r"(\S+)(?:\s+#?(-?\d+))?$", inp)
|
|
||||||
retrieve_chan = re.match(r"(#\S+)\s+(\S+)(?:\s+#?(-?\d+))?$", inp)
|
|
||||||
|
|
||||||
if retrieve:
|
|
||||||
select, num = retrieve.groups()
|
|
||||||
|
|
||||||
by_chan = False
|
|
||||||
if select.startswith('#'):
|
|
||||||
by_chan = True
|
|
||||||
quotes = get_quotes_by_chan(db, select)
|
|
||||||
else:
|
|
||||||
quotes = get_quotes_by_nick(db, chan, select)
|
|
||||||
elif retrieve_chan:
|
|
||||||
chan, nick, num = retrieve_chan.groups()
|
|
||||||
|
|
||||||
quotes = get_quotes_by_nick(db, chan, nick)
|
|
||||||
else:
|
|
||||||
return quote.__doc__
|
|
||||||
|
|
||||||
n_quotes = len(quotes)
|
|
||||||
|
|
||||||
if not n_quotes:
|
|
||||||
return "no quotes found"
|
|
||||||
|
|
||||||
num = int(num)
|
|
||||||
|
|
||||||
if num > n_quotes or (num < 0 and num < -n_quotes):
|
|
||||||
return "I only have %d quote%s for %s" % (n_quotes,
|
|
||||||
('s', '')[n_quotes == 1], select)
|
|
||||||
elif num < 0:
|
|
||||||
selected_quote = quotes[num]
|
|
||||||
num = n_quotes + num + 1
|
|
||||||
else:
|
|
||||||
selected_quote = quotes[num - 1]
|
|
||||||
|
|
||||||
return format_quote(selected_quote, num, n_quotes)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue