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",
|
||||
"UsePassword": true,
|
||||
"ConnectOnCreate": false,
|
||||
"HighlightNotifications": true,
|
||||
"Password": "s",
|
||||
"Default": {
|
||||
"password": null,
|
||||
|
|
21
threshold
21
threshold
|
@ -83,26 +83,41 @@ class IRCBot(IRCClient):
|
|||
|
||||
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:
|
||||
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]))
|
||||
|
||||
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:
|
||||
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]))
|
||||
|
||||
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:
|
||||
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]))
|
||||
|
||||
def get(self, var):
|
||||
|
|
Loading…
Reference in New Issue