some light housekeeping, reworking grog.py, renamed rundown() correctly
This commit is contained in:
parent
29f360067a
commit
58f3cce7d0
|
@ -1,7 +1,7 @@
|
||||||
NIGGER DICKS 2: Electric Boogaloo
|
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.
|
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:
|
TODO:
|
||||||
Fix the movie table
|
Fix the movie table
|
||||||
|
|
2
bot.py
2
bot.py
|
@ -72,7 +72,7 @@ class Fulvia(irc.IRCClient):
|
||||||
|
|
||||||
self._commands = {}
|
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.
|
of the function they call.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -10,18 +10,18 @@ from module import commands
|
||||||
@commands("grog")
|
@commands("grog")
|
||||||
def grog(bot, trigger):
|
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(os.path.join(bot.static, "grog.txt"), "r") as file:
|
||||||
with open(path, "r") as file:
|
data = file.read().splitlines()
|
||||||
data = file.read().split("\n")
|
num = None
|
||||||
num = 0
|
|
||||||
if trigger.group(2):
|
|
||||||
try:
|
try:
|
||||||
num = int(trigger.group(2)) - 1
|
num = int(trigger.group(2)) - 1
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if num and num < len(data):
|
if num == None:
|
||||||
|
num = random.randint(0, len(data)-1)
|
||||||
|
if num >= len(data)-1:
|
||||||
|
num = len(data)-1
|
||||||
bot.say(data[num])
|
bot.say(data[num])
|
||||||
else:
|
|
||||||
bot.say(random.choice(data))
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ from module import commands, example
|
||||||
|
|
||||||
@commands("rundown")
|
@commands("rundown")
|
||||||
@example(".rundown")
|
@example(".rundown")
|
||||||
def grog(bot, trigger):
|
def rundown(bot, trigger):
|
||||||
"""
|
"""
|
||||||
Provides rundown on demand.
|
Provides rundown on demand.
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user