28 lines
607 B
Python
Executable File
28 lines
607 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Selects a random Grog of Substantial Whimsy effect.
|
|
"""
|
|
import os
|
|
import random
|
|
|
|
from module import commands
|
|
|
|
@commands("grog")
|
|
def grog(bot, trigger):
|
|
"""
|
|
Picks a random status effect from Grog of Substantial Whimsy effect.
|
|
"""
|
|
path = os.path.join(bot.config["core"].get("homedir"), "static", "grog.txt")
|
|
with open(path, "r") as file:
|
|
data = file.read().split("\n")
|
|
num = 0
|
|
if trigger.group(2):
|
|
try:
|
|
num = int(trigger.group(2)) - 1
|
|
except:
|
|
pass
|
|
if num and num < len(data):
|
|
bot.say(data[num])
|
|
else:
|
|
bot.say(random.choice(data))
|