Implement notifications when the bot's nickname is said
This commit is contained in:
parent
e6367af7f2
commit
cc75535bcf
|
@ -6,6 +6,7 @@
|
||||||
"ListenerCertificate": "cert.pem",
|
"ListenerCertificate": "cert.pem",
|
||||||
"UsePassword": true,
|
"UsePassword": true,
|
||||||
"ConnectOnCreate": false,
|
"ConnectOnCreate": false,
|
||||||
|
"HighlightNotifications": true,
|
||||||
"Password": "s",
|
"Password": "s",
|
||||||
"Default": {
|
"Default": {
|
||||||
"password": null,
|
"password": null,
|
||||||
|
|
39
threshold
39
threshold
|
@ -83,26 +83,41 @@ class IRCBot(IRCClient):
|
||||||
|
|
||||||
def privmsg(self, user, channel, msg):
|
def privmsg(self, user, channel, msg):
|
||||||
toSend = helper.isKeyword(msg)
|
toSend = helper.isKeyword(msg)
|
||||||
if toSend:
|
if self.name == config["Master"][0] and channel == config["Master"][1]:
|
||||||
if self.name == config["Master"][0] and channel == config["Master"][1]:
|
pass
|
||||||
pass
|
else:
|
||||||
else:
|
if config["HighlightNotifications"]:
|
||||||
|
msgLower = msg.lower()
|
||||||
|
if self.nickname.lower() in msgLower:
|
||||||
|
msgLower = msgLower.replace(self.nickname, "{"+self.nickname+"}")
|
||||||
|
helper.sendMaster("NICK PRV %s (T:%s): (%s/%s) %s" % (self.name, msg.count(self.nickname), user, channel, msgLower))
|
||||||
|
if toSend:
|
||||||
helper.sendMaster("MATCH PRV %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))
|
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):
|
def noticed(self, user, channel, msg):
|
||||||
toSend = helper.isKeyword(msg)
|
toSend = helper.isKeyword(msg)
|
||||||
if toSend:
|
if self.name == config["Master"][0] and channel == config["Master"][1]:
|
||||||
if self.name == config["Master"][0] and channel == config["Master"][1]:
|
pass
|
||||||
pass
|
else:
|
||||||
else:
|
if config["HighlightNotifications"]:
|
||||||
|
msgLower = msg.lower()
|
||||||
|
if self.nickname.lower() in msgLower:
|
||||||
|
msgLower = msgLower.replace(self.nickname, "{"+self.nickname+"}")
|
||||||
|
helper.sendMaster("NICK NOT %s (T:%s): (%s/%s) %s" % (self.name, msg.count(self.nickname), user, channel, msgLower))
|
||||||
|
if toSend:
|
||||||
helper.sendMaster("MATCH NOT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))
|
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):
|
def action(self, user, channel, msg):
|
||||||
toSend = helper.isKeyword(msg)
|
toSend = helper.isKeyword(msg)
|
||||||
if toSend:
|
if self.name == config["Master"][0] and channel == config["Master"][1]:
|
||||||
if self.name == config["Master"][0] and channel == config["Master"][1]:
|
pass
|
||||||
pass
|
else:
|
||||||
else:
|
if config["HighlightNotifications"]:
|
||||||
|
msgLower = msg.lower()
|
||||||
|
if self.nickname.lower() in msgLower:
|
||||||
|
msgLower = msgLower.replace(self.nickname, "{"+self.nickname+"}")
|
||||||
|
helper.sendMaster("NICK ACT %s (T:%s): (%s/%s) %s" % (self.name, msg.count(self.nickname), user, channel, msgLower))
|
||||||
|
if toSend:
|
||||||
helper.sendMaster("MATCH ACT %s (U:%s T:%s): (%s/%s) %s" % (self.name, toSend[1], toSend[2], user, channel, toSend[0]))
|
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):
|
||||||
|
|
Loading…
Reference in New Issue