1. Fabrice Gabolde
  2. Krakenbot

Commits

Fabrice Gabolde  committed 6c48d99

Mechanism to allow MegaHAL to listen on only whitelisted channels.

  • Participants
  • Parent commits eb7fe33
  • Branches default

Comments (0)

Files changed (1)

File krakenbot-megahal.el

View file
 
 ;;; Code:
 
+(defcustom kbot-megahal-channels-enabled
+  '()
+  "List of channels on which MegaHAL should wait for messages."
+  :type '(repeat string))
+
 (defvar kbot-megahal-ignore-words
   '("#QUIT"
     "#EXIT"
 
 (defun kbot-megahal-listen (kbot-erc-process kbot-channel-name kbot-sender-name kbot-message)
   "Pass a message heard on the channel on to MegaHAL."
-  (unless (erc-nick-equal-p kbot-sender-name (erc-current-nick)) ; ignore ourselves
+  (unless (or
+           (erc-nick-equal-p kbot-sender-name (erc-current-nick)) ; ignore ourselves
+           (not (member kbot-channel-name kbot-megahal-channels-enabled)))
     (message "Calling kbot-megahal-listen with [%s] [%s] [%s]" kbot-channel-name kbot-sender-name kbot-message)
     (process-send-string "kbot-megahal-process"
 			 (concat (kbot-megahal-sanitize-input kbot-message) "\n\n"))