Don't send keyword notifications if the message source is the reporting channel

This commit is contained in:
Mark Veidemanis 2017-11-25 19:02:13 +00:00
parent 742d9c0c91
commit 2ef3782c6d
1 changed files with 24 additions and 15 deletions

View File

@ -67,21 +67,6 @@ class IRCBot(IRCClient):
else: else:
self.password = instance["password"] self.password = instance["password"]
def privmsg(self, user, channel, msg):
toSend = helper.isKeyword(msg)
if toSend:
helper.sendMaster("MATCH PRV %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))
def noticed(self, user, channel, msg):
toSend = helper.isKeyword(msg)
if toSend:
helper.sendMaster("MATCH NOT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))
def action(self, user, channel, msg):
toSend = helper.isKeyword(msg)
if toSend:
helper.sendMaster("MATCH ACT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))
def refresh(self): def refresh(self):
instance = pool[self.name] instance = pool[self.name]
if not instance["nickname"] == self.nickname: if not instance["nickname"] == self.nickname:
@ -95,6 +80,30 @@ class IRCBot(IRCClient):
self.versionEnv = None self.versionEnv = None
self.sourceURL = instance["source"] self.sourceURL = instance["source"]
def privmsg(self, user, channel, msg):
toSend = helper.isKeyword(msg)
if toSend:
if self.name == config["Master"][0] and channel == config["Master"][1]:
pass
else:
helper.sendMaster("MATCH PRV %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))
def noticed(self, user, channel, msg):
toSend = helper.isKeyword(msg)
if toSend:
if self.name == config["Master"][0] and channel == config["Master"][1]:
pass
else:
helper.sendMaster("MATCH NOT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))
def action(self, user, channel, msg):
toSend = helper.isKeyword(msg)
if toSend:
if self.name == config["Master"][0] and channel == config["Master"][1]:
pass
else:
helper.sendMaster("MATCH ACT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))
def get(self, var): def get(self, var):
try: try:
result = getattr(self, var) result = getattr(self, var)