Move lists out of scope

This commit is contained in:
dngfx 2018-09-01 11:40:08 +01:00
parent 80cbf2d66e
commit 7db9a8ea2b
2 changed files with 27 additions and 29 deletions

View file

@ -1,17 +1,6 @@
import random
class Module(object):
def __init__(self, bot, events):
events.on("received.command.8ball").hook(
self.decide,
min_args=1,
help="Ask the mystic 8ball a question!",
usage="<question>"
)
def decide(selfs, event):
choices = [
CHOICES = [
"Definitely",
"Yes",
"Probably",
@ -27,4 +16,14 @@ class Module(object):
"I'm on a break, ask again later"
]
event["stdout"].write(random.choice(choices))
class Module(object):
def __init__(self, bot, events):
events.on("received.command.8ball").hook(
self.decide,
min_args=1,
help="Ask the mystic 8ball a question!",
usage="<question>"
)
def decide(selfs, event):
event["stdout"].write(random.choice(CHOICES))

View file

@ -3,15 +3,7 @@ from threading import Timer
import Utils
import random
class Module(object):
def __init__(self, bot, events):
self.bot = bot
self.events = events
self.decoy_hooked = 0
self.duck_timer = None
self.duck_list = [
DUCK_LIST = [
"・゜゜・。。・゜ \_O< quack!",
"・゜゜・。。・゜ \_o< QUACK!",
"・゜゜・。 。・゜゜\_ó< quack!",
@ -21,6 +13,13 @@ class Module(object):
"・ ゜・。 。・゜゜ \_ó< beep beep!"
]
class Module(object):
def __init__(self, bot, events):
self.bot = bot
self.events = events
self.decoy_hooked = 0
self.duck_timer = None
events.on("received.command.bef").hook(self.duck_bef,
help="Befriend a duck!")
events.on("received.command.bang").hook(self.duck_bang,
@ -252,7 +251,7 @@ class Module(object):
str) else active_duck
if ducks_enabled == 1 and active_duck == 0:
channel.send_message(random.choice(self.duck_list))
channel.send_message(random.choice(DUCK_LIST))
channel.set_setting("active-duck", 1)
@ -263,7 +262,7 @@ class Module(object):
channel.set_setting("active-duck", 0)
def duck_decoy(self, event):
event["stdout"].write(random.choice(self.duck_list))
event["stdout"].write(random.choice(DUCK_LIST))
def set_decoy(self, event):
channel = event["target"]