Code: Select all
#=================================================================================
# ** Notification(c) 1.0 by Hen Asraf
#=================================================================================
# * What does it do?
#---------------------------------------------------------------------------------
# Reads from the keywords list and sends a PM to every nick in the nicknames
# list whenever any of the keywords are mentioned in one of the bot's channels.
# It also sends the original time of which it was triggered to prevent the lag
# from causing a delay without the users knowing.
#
# Good for cases where the botmaster is asleep or away and wouldn't want to miss
# messages that were referring to them or something important.
#=================================================================================
# Set the keywords to trigger the notifier. Seperate with a space.
set keywords "Spide Spidy kumo kami"
# Set the nicknames to send the PM to. Seperate with a space.
set nicknames "kumoKami"
# MAIN #
# Turn the keywords and nicknames variables into lists.
set keywords [split $keywords ]
set nicknames [split $nicknames ]
# For each keyword in the list, bind the keyword to the spidey:notify procedure.
foreach keyword $keywords {
bind pubm * "*$keyword*" spidey:notify
bind ctcp * "ACTION*$keyword*" spidey:notify_tcl
}
# Start procedure
proc spidey:notify { nick host hand chan text } {
# If the notified user said one of the keywords, you don't have to trigger the
# messsage.
foreach nickname $::nicknames {
if { $nick != "$nickname" } {
# Send the message in the following format:
# (@time) [ #channel ] Nickname: Entire line containing the keyword(s)
putserv "PRIVMSG $nickname :(@[strftime {%I:%M:%S %p}]) \[ $chan \] \002$nick:\002 \00312$text\003"
}
}
}
# Action procedure (/me)
proc spidey:notify_tcl { nick host hand chan key text } {
# If the notified user said one of the keywords, you don't have to trigger the
# messsage.
foreach nickname $::nicknames {
if { $nick != "$nickname" } {
# Send the message in the following format:
# (@time) [ #channel ] Nickname: Entire line containing the keyword(s)
putserv "PRIVMSG $nickname :(@[strftime {%I:%M:%S %p}]) \[ $chan \] \0036\002$nick\002 $text\003"
}
}
}
# When successfully loaded, put this line into the partyline for logging purposes.
putlog "Notification 1.0 by Hen Asraf: Loaded"