I need to monitor few IRC channels and I use Emacs so I write simple elisp function that I append to erc-insert-pre-hook and it notify me when there is some activity on those channels. I made this mainly because I what to know if someone visit #openclipart channel (because people where visiting ask question and leave after few minutes, there is no much activity on this channel)
(setq inactivity-buffer-alist '(("#openclipart" (inactivity . 900))
("#hackerrank" (inactivity . 900))
("#aiki" (inactivity . 900))))
(defun channel-activity (string &rest ignore)
"notification when there is activity on a erc channel after inactivity"
(let* ((buffer (buffer-name))
(buffer-alist-pair (assoc buffer inactivity-buffer-alist))
(buffer-alist (cdr buffer-alist-pair))
(current-time (current-time)))
(if (not (null buffer-alist))
(let ((last-time-pair (assoc 'last-time buffer-alist))
(inactivity (cdr (assoc 'inactivity buffer-alist))))
(if (not (and (string-match "^\\*\\*\\*" string)
(string-match "[freenode-info]" string)))
(progn
(if (or (null last-time-pair)
(> (float-time (time-subtract current-time
(cdr last-time-pair)))
inactivity))
(async-exec-command "mpg123 -q /home/kuba/Pobrane/beep-6.mp3"))
(if (null last-time-pair)
(setf (cdr buffer-alist-pair)
(append buffer-alist
(list (cons 'last-time current-time))))
(setf (cdr last-time-pair) current-time))))))))
(add-hook 'erc-insert-pre-hook 'channel-activity)
You can add your channels to inactivity-buffer-alist along with time of inactivity (in miliseconds)
The function I use for notification is play sound using (async-exec-command "mpg123 -q /home/kuba/Pobrane/beep-6.mp3") – normal shell command was stoping execution of Emacs for few seconds
The code for this function is as follow
(defun async-exec-command (command &rest success)
(interactive)
(let* ((buffer-name (generate-new-buffer-name "**shell**"))
(buffer (get-buffer-create buffer-name))
(process (apply #'start-process
(append (list buffer-name buffer)
(split-string command " ")))))
(lexical-let ((buffer buffer) (success (car success)) (command command))
(set-process-sentinel process
(if success (lambda (process str)
(if (string= str "finished\n")
(save-excursion
(set-buffer buffer)
(let ((content (buffer-string)))
(kill-buffer buffer)
(funcall success content)))))
(lambda (proces str)
(kill-buffer buffer)))))
(concat "execute: " command)))

