Add ask command

I'm piggybacking off of WriterBot for the question lists, mainly to save space on cosmic.
This commit is contained in:
Robert Miles 2019-11-03 12:06:49 -05:00
parent d6a7a7b40a
commit 856a382907
1 changed files with 21 additions and 0 deletions

21
commands/ask.py Normal file
View File

@ -0,0 +1,21 @@
import plugin,utils,random
chars = utils.get("https://raw.githack.com/cwarwicker/discord-WriterBot/master/assets/json/en/q_char.json")
world = utils.get("https://raw.githack.com/cwarwicker/discord-WriterBot/master/assets/json/en/q_world.json")
@plugin.group("ask","<c/w>")
def ask(bot,channel,nick,subcmd,*args):
if subcmd not in "cw":
bot.say(channel,"{}: Usage: !ask <c/w>".format(nick))
return True
return False
@ask.command("c")
def ask_char(bot,channel,nick,*args):
question = random.choice(chars)
bot.say(channel,nick,"{}: {!s}. {}".format(nick,chars.index(question),question))
@ask.command("w")
def ask_world(bot,channel,nick,*args):
question = random.choice(world)
bot.say(channel,nick,"{}: {!s}. {}".format(nick,world.index(question),question))