some light housekeeping, reworking grog.py, renamed rundown() correctly

This commit is contained in:
iou1name 2018-03-28 23:03:06 -04:00
parent 29f360067a
commit 58f3cce7d0
4 changed files with 17 additions and 17 deletions

View File

@ -1,7 +1,7 @@
NIGGER DICKS 2: Electric Boogaloo
It's like Sopel, except rewritten from scratch using Twisted as a base and over half the features ripped out.
Dependencies: `twisted, python-dateutil, wolfram, requests, bs4, pyenchant`
Dependencies: `twisted, python-dateutil, requests, bs4, wolfram, pyenchant`
TODO:
Fix the movie table

2
bot.py
View File

@ -72,7 +72,7 @@ class Fulvia(irc.IRCClient):
self._commands = {}
"""
A dictionary containingv all commands to look for and the name
A dictionary containing all commands to look for and the name
of the function they call.
"""

View File

@ -10,18 +10,18 @@ from module import commands
@commands("grog")
def grog(bot, trigger):
"""
Picks a random status effect from Grog of Substantial Whimsy effect.
Prints a status effect from Grog of Substantial Whimsy effect. If an
index is not given, a random one is chosen.
"""
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))
with open(os.path.join(bot.static, "grog.txt"), "r") as file:
data = file.read().splitlines()
num = None
try:
num = int(trigger.group(2)) - 1
except:
pass
if num == None:
num = random.randint(0, len(data)-1)
if num >= len(data)-1:
num = len(data)-1
bot.say(data[num])

View File

@ -9,7 +9,7 @@ from module import commands, example
@commands("rundown")
@example(".rundown")
def grog(bot, trigger):
def rundown(bot, trigger):
"""
Provides rundown on demand.
"""