I have this function
(defun mention-notify (match-type nickuserhost msg)
(interactive)
(if (and (eq match-type 'current-nick)
(eq (string-match "^-NickServ-" msg) nil) ;this is probably not needed
(eq (string-match "^\\*\\*\\*" msg) nil))
(progn
(shell-command "mpg123 -q /home/kuba/Pobrane/beep-8.mp3")
(notify "ERC" msg))))
(add-hook 'erc-text-matched-hook 'mention-notify)
But it execute command even it message start from ***. What I’m doing wrong here? How this function should look like?
I read that page but it only show how to send notification for all mentions, even from server. like:
*** Users on #<chanel>: jcubic...
or
*** jcubic has changed mode for jcubic to +i
It seams that when I check for 'current-nick – msg is not the whole message but substring containing my nick, I try to check for keyword instead of current-nick and check if my nick that I always use appear in the text but using keyword doesn’t work at all.
I copied
erc-match-messagefunction from erc.el file into my .emacs file and I added one flag to hooklast flag is set if message is erc system message – starts with
***so now I can check this flag in my hookUPDATE I also didn’t want to recive message from -NickServ- so I add this