font reset at the beginning of commands to stop wonkiness with highlighting and fix duck decoys.
This commit is contained in:
parent
000ee14711
commit
febb6d66e3
2 changed files with 12 additions and 7 deletions
|
@ -29,7 +29,8 @@ class Out(object):
|
||||||
].decode("utf8").lstrip())
|
].decode("utf8").lstrip())
|
||||||
else:
|
else:
|
||||||
self._text = ""
|
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):
|
def set_prefix(self, prefix):
|
||||||
self.module_name = prefix
|
self.module_name = prefix
|
||||||
def has_text(self):
|
def has_text(self):
|
||||||
|
|
|
@ -100,6 +100,7 @@ class Module(object):
|
||||||
def clear_ducks(self, channel):
|
def clear_ducks(self, channel):
|
||||||
rand_time = self.generate_next_duck_time()
|
rand_time = self.generate_next_duck_time()
|
||||||
|
|
||||||
|
del channel.games["ducks"]
|
||||||
channel.games["ducks"] = {'messages': 0, 'duck_spawned': 0,
|
channel.games["ducks"] = {'messages': 0, 'duck_spawned': 0,
|
||||||
'unique_users': [],
|
'unique_users': [],
|
||||||
'next_duck_time': rand_time,
|
'next_duck_time': rand_time,
|
||||||
|
@ -126,10 +127,11 @@ class Module(object):
|
||||||
rand_time = random.randint(int(time()) + 1, int(time()) + 2)
|
rand_time = random.randint(int(time()) + 1, int(time()) + 2)
|
||||||
return rand_time
|
return rand_time
|
||||||
|
|
||||||
def is_duck_visible(self, event):
|
def is_duck_visible(self, event, decoy=False):
|
||||||
channel = event["target"]
|
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
|
return visible
|
||||||
|
|
||||||
def should_kick(self, event):
|
def should_kick(self, event):
|
||||||
|
@ -259,11 +261,12 @@ class Module(object):
|
||||||
if self.is_duck_channel(channel) == False:
|
if self.is_duck_channel(channel) == False:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.is_duck_visible(event) == False:
|
if self.is_duck_visible(event, False) == False:
|
||||||
if self.should_kick(event):
|
if self.should_kick(event):
|
||||||
self.kick_bef(event)
|
self.kick_bef(event)
|
||||||
self.clear_ducks(channel)
|
|
||||||
event.eat()
|
event.eat()
|
||||||
|
|
||||||
|
self.clear_ducks(channel)
|
||||||
return
|
return
|
||||||
|
|
||||||
channel.games["ducks"][
|
channel.games["ducks"][
|
||||||
|
@ -293,11 +296,12 @@ class Module(object):
|
||||||
if self.is_duck_channel(channel) == False:
|
if self.is_duck_channel(channel) == False:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.is_duck_visible(event) == False:
|
if self.is_duck_visible(event, False) == False:
|
||||||
if self.should_kick(event):
|
if self.should_kick(event):
|
||||||
self.kick_bang(event)
|
self.kick_bang(event)
|
||||||
self.clear_ducks(channel)
|
|
||||||
event.eat()
|
event.eat()
|
||||||
|
|
||||||
|
self.clear_ducks(channel)
|
||||||
return
|
return
|
||||||
|
|
||||||
channel.games["ducks"][
|
channel.games["ducks"][
|
||||||
|
|
Loading…
Reference in a new issue