diff --git a/modules/grog.py b/modules/grog.py index 97f5fb8..65ce1b6 100755 --- a/modules/grog.py +++ b/modules/grog.py @@ -46,3 +46,22 @@ def magic(bot, trigger): if num >= len(data)-1: num = len(data)-1 bot.msg(data[num]) + + +@commands("ship") +def magic(bot, trigger): + """ + Prints a ship quirk. If an index is not given, a random one is chosen. + """ + with open(os.path.join(bot.static, "ship_quirks.txt"), "r") as file: + data = file.read().splitlines() + num = None + try: + num = int(trigger.args[1]) - 1 + except (IndexError, ValueError): + pass + if num == None: + num = random.randint(0, len(data)-1) + if num >= len(data)-1: + num = len(data)-1 + bot.msg(data[num])