mirror of
https://github.com/nikdoof/dropbot.git
synced 2025-12-19 20:59:24 +00:00
Add the ability to mute kills
This commit is contained in:
@@ -46,6 +46,7 @@ class DropBot(ClientXMPP):
|
||||
self.last_killdate = datetime.utcnow()
|
||||
self.kill_corps = [int(x) for x in kwargs.pop('kill_corps', [])]
|
||||
self.kill_check_timeout = kwargs.pop('kill_check_timeout', 300)
|
||||
self.kills_muted = False
|
||||
|
||||
self.redis_pool = ConnectionPool.from_url(kwargs.pop('redis_url', 'redis://localhost:6379/0'))
|
||||
self.redis = Redis(connection_pool=self.redis_pool)
|
||||
@@ -610,4 +611,11 @@ class DropBot(ClientXMPP):
|
||||
len(kill['attackers']),
|
||||
intcomma(kill['zkb']['totalValue']),
|
||||
url,
|
||||
)
|
||||
|
||||
def cmd_togglekills(self, args, msg):
|
||||
"""Toggles the broadcasting of kills to MUC channels"""
|
||||
self.kills_muted = not self.kills_muted
|
||||
return 'Kill messages: {}'.format(
|
||||
'muted' if self.kills_muted else 'not muted'
|
||||
)
|
||||
@@ -25,8 +25,9 @@ class ZKillboardStompListener(object):
|
||||
print message
|
||||
body, html = self.bot.call_command('kill', [], None, no_url=False, raw=kill)
|
||||
text = 'New Kill: {}'.format(body)
|
||||
for room in self.bot.rooms:
|
||||
self.bot.send_message(room, text, mtype='groupchat')
|
||||
if not self.bot.kills_muted:
|
||||
for room in self.bot.rooms:
|
||||
self.bot.send_message(room, text, mtype='groupchat')
|
||||
|
||||
|
||||
def connect(self, url):
|
||||
|
||||
Reference in New Issue
Block a user