Move lists out of scope
This commit is contained in:
parent
80cbf2d66e
commit
7db9a8ea2b
2 changed files with 27 additions and 29 deletions
|
@ -1,5 +1,20 @@
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
CHOICES = [
|
||||||
|
"Definitely",
|
||||||
|
"Yes",
|
||||||
|
"Probably",
|
||||||
|
"Maybe",
|
||||||
|
"Probably not",
|
||||||
|
"No",
|
||||||
|
"Definitely not",
|
||||||
|
"I don't know",
|
||||||
|
"Ask again later",
|
||||||
|
"The answer is unclear",
|
||||||
|
"Absolutely",
|
||||||
|
"Dubious at best",
|
||||||
|
"I'm on a break, ask again later"
|
||||||
|
]
|
||||||
|
|
||||||
class Module(object):
|
class Module(object):
|
||||||
def __init__(self, bot, events):
|
def __init__(self, bot, events):
|
||||||
|
@ -11,20 +26,4 @@ class Module(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
def decide(selfs, event):
|
def decide(selfs, event):
|
||||||
choices = [
|
event["stdout"].write(random.choice(CHOICES))
|
||||||
"Definitely",
|
|
||||||
"Yes",
|
|
||||||
"Probably",
|
|
||||||
"Maybe",
|
|
||||||
"Probably not",
|
|
||||||
"No",
|
|
||||||
"Definitely not",
|
|
||||||
"I don't know",
|
|
||||||
"Ask again later",
|
|
||||||
"The answer is unclear",
|
|
||||||
"Absolutely",
|
|
||||||
"Dubious at best",
|
|
||||||
"I'm on a break, ask again later"
|
|
||||||
]
|
|
||||||
|
|
||||||
event["stdout"].write(random.choice(choices))
|
|
||||||
|
|
|
@ -3,6 +3,15 @@ from threading import Timer
|
||||||
import Utils
|
import Utils
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
DUCK_LIST = [
|
||||||
|
"・゜゜・。。・゜ ゜\_O< quack!",
|
||||||
|
"・゜゜・。。・゜ ゜\_o< QUACK!",
|
||||||
|
"・゜゜・。 。・゜゜\_ó< quack!",
|
||||||
|
"・゜゜・。 。・゜゜\_ó< quack quack!",
|
||||||
|
"・゜゜ 。 。・゜ \_ó< bawk!",
|
||||||
|
"・゜゜ 。 。・゜゜\_ó< squawk!",
|
||||||
|
"・ ゜・。 。・゜゜ \_ó< beep beep!"
|
||||||
|
]
|
||||||
|
|
||||||
class Module(object):
|
class Module(object):
|
||||||
def __init__(self, bot, events):
|
def __init__(self, bot, events):
|
||||||
|
@ -11,16 +20,6 @@ class Module(object):
|
||||||
self.decoy_hooked = 0
|
self.decoy_hooked = 0
|
||||||
self.duck_timer = None
|
self.duck_timer = None
|
||||||
|
|
||||||
self.duck_list = [
|
|
||||||
"・゜゜・。。・゜ ゜\_O< quack!",
|
|
||||||
"・゜゜・。。・゜ ゜\_o< QUACK!",
|
|
||||||
"・゜゜・。 。・゜゜\_ó< quack!",
|
|
||||||
"・゜゜・。 。・゜゜\_ó< quack quack!",
|
|
||||||
"・゜゜ 。 。・゜ \_ó< bawk!",
|
|
||||||
"・゜゜ 。 。・゜゜\_ó< squawk!",
|
|
||||||
"・ ゜・。 。・゜゜ \_ó< beep beep!"
|
|
||||||
]
|
|
||||||
|
|
||||||
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!")
|
||||||
events.on("received.command.bang").hook(self.duck_bang,
|
events.on("received.command.bang").hook(self.duck_bang,
|
||||||
|
@ -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