added --list to .slur
This commit is contained in:
parent
a2554f3c2f
commit
f7cbd18f6e
|
@ -31,13 +31,23 @@ def slur(bot, trigger):
|
|||
|
||||
-r, --race - specifies a particular race to pick on.
|
||||
-s, --slur - specifies a particular slur to pick.
|
||||
-l, --list - prints a list of available races.
|
||||
"""
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-r", "--race", type=str)
|
||||
parser.add_argument("-r", "--race", type=str, nargs='+')
|
||||
parser.add_argument("-s", "--slur", type=str)
|
||||
parser.add_argument("-l", "--list", action="store_true")
|
||||
args = parser.parse_args(trigger.group[3:])
|
||||
|
||||
if args.list:
|
||||
races = bot.db.execute("SELECT DISTINCT race FROM slur").fetchall()
|
||||
races = [race[0] for race in races]
|
||||
races.sort()
|
||||
bot.msg(", ".join(races))
|
||||
return
|
||||
|
||||
if args.race:
|
||||
args.race = " ".join(args.race)
|
||||
slur = bot.db.execute(
|
||||
"SELECT * FROM `slur` WHERE `race` = ? COLLATE NOCASE " \
|
||||
+ "ORDER BY RANDOM() LIMIT 1", (args.race,)).fetchone()
|
||||
|
|
Loading…
Reference in New Issue
Block a user