cosmicbot/commands/ask.py

23 lines
776 B
Python

import plugin,utils,random,importlib
importlib.reload(utils)
chars = utils.get("https://github.com/mblake/discord-WriterBot/raw/master/assets/json/q_char.json")
world = utils.get("https://github.com/mblake/discord-WriterBot/raw/master/assets/json/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,"{}: {!s}. {}".format(nick,chars.index(question),question))
@ask.command("w")
def ask_world(bot,channel,nick,*args):
question = random.choice(world)
bot.say(channel,"{}: {!s}. {}".format(nick,world.index(question),question))