forked from khuxkm/cosmicbot
17 lines
438 B
Python
17 lines
438 B
Python
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):
|
|
if len(args)==1:
|
|
prompt_ = prompts[int(args[0])-1]
|
|
else:
|
|
prompt_ = random.choice(prompts)
|
|
bot.say(channel,"{}: {!s}. {}".format(nick,prompts.index(prompt_)+1,prompt_))
|