29 lines
622 B
Python
29 lines
622 B
Python
|
#! /usr/bin/env python3
|
||
|
# -*- coding: utf-8 -*-
|
||
|
"""
|
||
|
Selects a random Grog of Substantial Whimsy effect.
|
||
|
"""
|
||
|
import os
|
||
|
import random
|
||
|
|
||
|
from module import commands, example
|
||
|
|
||
|
@commands("grog")
|
||
|
@example(".grog")
|
||
|
def grog(bot, trigger):
|
||
|
"""
|
||
|
Picks a random status effect from Grog of Substantial Whimsy effect.
|
||
|
"""
|
||
|
with open(os.path.join(bot.config.homedir, "grog.txt"), "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))
|