aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar dngfx2018-09-22 19:10:52 +0100
committerGravatar dngfx2018-09-22 19:10:52 +0100
commitfebb6d66e3fd29c5d18c4c49133b0aef9257f2e1 (patch)
tree033b35544312f72d58fdc08d480aa24125a1832b /modules
parentMake tweets say Twitter instead of tweets, and update ducks to add decoys and... (diff)
signature
font reset at the beginning of commands to stop wonkiness with highlighting and fix duck decoys.
Diffstat (limited to 'modules')
-rw-r--r--modules/commands.py3
-rw-r--r--modules/ducks.py16
2 files changed, 12 insertions, 7 deletions
diff --git a/modules/commands.py b/modules/commands.py
index f0068c57..9df70ffc 100644
--- a/modules/commands.py
+++ b/modules/commands.py
@@ -29,7 +29,8 @@ class Out(object):
].decode("utf8").lstrip())
else:
self._text = ""
- self.target.send_message(text, prefix="[%s] " % self.prefix())
+ self.target.send_message(text, prefix=Utils.FONT_RESET + "[%s] " %
+ self.prefix())
def set_prefix(self, prefix):
self.module_name = prefix
def has_text(self):
diff --git a/modules/ducks.py b/modules/ducks.py
index 7fa32910..ebef9006 100644
--- a/modules/ducks.py
+++ b/modules/ducks.py
@@ -100,6 +100,7 @@ class Module(object):
def clear_ducks(self, channel):
rand_time = self.generate_next_duck_time()
+ del channel.games["ducks"]
channel.games["ducks"] = {'messages': 0, 'duck_spawned': 0,
'unique_users': [],
'next_duck_time': rand_time,
@@ -126,10 +127,11 @@ class Module(object):
rand_time = random.randint(int(time()) + 1, int(time()) + 2)
return rand_time
- def is_duck_visible(self, event):
+ def is_duck_visible(self, event, decoy=False):
channel = event["target"]
- visible = channel.games["ducks"]["duck_spawned"]
+ visible = channel.games["ducks"]["decoy_spawned"] if \
+ decoy else channel.games["ducks"]["duck_spawned"]
return visible
def should_kick(self, event):
@@ -259,11 +261,12 @@ class Module(object):
if self.is_duck_channel(channel) == False:
return
- if self.is_duck_visible(event) == False:
+ if self.is_duck_visible(event, False) == False:
if self.should_kick(event):
self.kick_bef(event)
- self.clear_ducks(channel)
event.eat()
+
+ self.clear_ducks(channel)
return
channel.games["ducks"][
@@ -293,11 +296,12 @@ class Module(object):
if self.is_duck_channel(channel) == False:
return
- if self.is_duck_visible(event) == False:
+ if self.is_duck_visible(event, False) == False:
if self.should_kick(event):
self.kick_bang(event)
- self.clear_ducks(channel)
event.eat()
+
+ self.clear_ducks(channel)
return
channel.games["ducks"][