Move lists out of scope
This commit is contained in:
parent
80cbf2d66e
commit
7db9a8ea2b
2 changed files with 27 additions and 29 deletions
|
@ -1,17 +1,6 @@
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
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):
|
|
||||||
choices = [
|
|
||||||
"Definitely",
|
"Definitely",
|
||||||
"Yes",
|
"Yes",
|
||||||
"Probably",
|
"Probably",
|
||||||
|
@ -25,6 +14,16 @@ class Module(object):
|
||||||
"Absolutely",
|
"Absolutely",
|
||||||
"Dubious at best",
|
"Dubious at best",
|
||||||
"I'm on a break, ask again later"
|
"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))
|
||||||
|
|
|
@ -3,15 +3,7 @@ from threading import Timer
|
||||||
import Utils
|
import Utils
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
DUCK_LIST = [
|
||||||
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 = [
|
|
||||||
"・゜゜・。。・゜ ゜\_O< quack!",
|
"・゜゜・。。・゜ ゜\_O< quack!",
|
||||||
"・゜゜・。。・゜ ゜\_o< QUACK!",
|
"・゜゜・。。・゜ ゜\_o< QUACK!",
|
||||||
"・゜゜・。 。・゜゜\_ó< quack!",
|
"・゜゜・。 。・゜゜\_ó< quack!",
|
||||||
|
@ -19,7 +11,14 @@ class Module(object):
|
||||||
"・゜゜ 。 。・゜ \_ó< bawk!",
|
"・゜゜ 。 。・゜ \_ó< bawk!",
|
||||||
"・゜゜ 。 。・゜゜\_ó< squawk!",
|
"・゜゜ 。 。・゜゜\_ó< squawk!",
|
||||||
"・ ゜・。 。・゜゜ \_ó< beep beep!"
|
"・ ゜・。 。・゜゜ \_ó< 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,
|
events.on("received.command.bef").hook(self.duck_bef,
|
||||||
help="Befriend a duck!")
|
help="Befriend a duck!")
|
||||||
|
@ -252,7 +251,7 @@ class Module(object):
|
||||||
str) else active_duck
|
str) else active_duck
|
||||||
|
|
||||||
if ducks_enabled == 1 and active_duck == 0:
|
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)
|
channel.set_setting("active-duck", 1)
|
||||||
|
|
||||||
|
@ -263,7 +262,7 @@ class Module(object):
|
||||||
channel.set_setting("active-duck", 0)
|
channel.set_setting("active-duck", 0)
|
||||||
|
|
||||||
def duck_decoy(self, event):
|
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):
|
def set_decoy(self, event):
|
||||||
channel = event["target"]
|
channel = event["target"]
|
||||||
|
|
Loading…
Reference in a new issue