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,5 +1,20 @@
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):
def __init__(self, bot, events):
@ -11,20 +26,4 @@ class Module(object):
)
def decide(selfs, event):
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))
event["stdout"].write(random.choice(CHOICES))

View file

@ -3,6 +3,15 @@ from threading import Timer
import Utils
import random
DUCK_LIST = [
"・゜゜・。。・゜ \_O< quack!",
"・゜゜・。。・゜ \_o< QUACK!",
"・゜゜・。 。・゜゜\_ó< quack!",
"・゜゜・。 。・゜゜\_ó< quack quack!",
"・゜゜ 。 。・゜ \_ó< bawk!",
"・゜゜ 。 。・゜゜\_ó< squawk!",
"・ ゜・。 。・゜゜ \_ó< beep beep!"
]
class Module(object):
def __init__(self, bot, events):
@ -11,16 +20,6 @@ class Module(object):
self.decoy_hooked = 0
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,
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"]