First draft of prompt function

This commit is contained in:
Robert Miles 2019-11-03 11:47:49 -05:00
parent 031060a80e
commit d6a7a7b40a
1 changed files with 13 additions and 0 deletions

13
commands/prompt.py Normal file
View File

@ -0,0 +1,13 @@
import plugin,requests,random
def get(*args,**kwargs):
r = requests.get(*args,**kwargs)
r.raise_for_status()
return r.json()
prompts = get("https://khuxkm.tilde.team/prompts.json")["prompts"]
@plugin.command("prompt","")
def prompt(bot,channel,nick,*args):
prompt_ = random.choice(prompts)
bot.say(channel,"{}: {!s}. {}".format(nick,prompts.index(prompt_)+1,prompt_))