作者 Anonymous [lisp] 2012-01-24 23:09 (点击下载)

  1. ;;Another Bot
  2. (defun ibot-hello ()
  3. "Hello someone when she/he say regexp something
  4. This function should be in the insert-post-hook."
  5. (goto-char (point-min))
  6. (when (re-search-forward
  7. (concat "\(<\([^>]*\)>\)" ; <someone> "<nickname>"
  8. "\("
  9. "\([ ]*\(hello\|hi\)[ ,.!?~;,。!~]?[ ]*$\)"
  10. "\|"
  11. "\(.*[木没]?有人[在]?[没不么吗].*\)"
  12. "\|"
  13. "\([^:,,]*[请]?[教问][一]?\(个问题\|一下\)[ ,.!?~;,。!~]?$\)"
  14. "\|"
  15. "\([ ]*\(test\|测试\|测试一下\|测试下\|试试\)[ ]*$\)"
  16. "\|"
  17. "\([ ]*[大各]+[位家]+好.*\)"
  18. "\|"
  19. "\(.*\(苍井空\|小月月\|凤姐\|芙蓉姐姐\).*\)"
  20. "\|"
  21. "\([ ]*[木灭l]?[o]?[l哈呵]+[ .,@#$%^&*;:'`/?!!~~]*$\)"
  22. "\|"
  23. "\([ ]*同志们.*好.*\)"
  24. "\|"
  25. "\(.*ylmf.*\)"
  26. "\)"
  27. )
  28. nil t)
  29. (when (and (not (string-equal (regexp-quote (erc-current-nick)) (match-string-no-properties 2)))
  30. (not (erc-list-match erc-fools (match-string-no-properties 2)))
  31. (not (erc-list-match erc-keywords (match-string-no-properties 2))))
  32. (setq nick (match-string-no-properties 2))
  33. ;; (when (< 0 (length (match-string-no-properties 4))) ;; for hello,hi
  34. ;; (erc-send-message (concat nick ": " "hey,老大~ ;-)")))
  35. (when (< 0 (length (match-string-no-properties 6))) ;有人么
  36. ;; (erc-send-message (concat nick ": " "你是MM不 ;-)")))
  37. (erc-send-message (concat ": " "木有人!!! http://forum.ubuntu.org.cn/viewtopic.php?f=95&t=267605 ;)")))
  38. (when (< 0 (length (match-string-no-properties 7)))
  39. (erc-send-message (concat nick ": " "问呗,GG|MM http://forum.ubuntu.org.cn/viewtopic.php?f=95&t=267605 :-)")))
  40. (when (< 0 (length (match-string-no-properties 9))) ;; for test
  41. (erc-send-message (concat ": " (yow) " http://forum.ubuntu.org.cn/viewtopic.php?f=95&t=267605 :-)")))
  42. (when (< 0 (length (match-string-no-properties 11))) ;大家好
  43. (erc-send-message (concat nick ": " "你好~ http://forum.ubuntu.org.cn/viewtopic.php?f=95&t=267605 :)"))) ;ubuntu910教程。
  44. (when (< 0 (length (match-string-no-properties 12)))
  45. (erc-send-message (concat nick ": " "hoho~~>:-) :-(")))
  46. ;; (when (< 0 (length (match-string-no-properties 14)))
  47. ;; (erc-send-message (concat nick ": " "lol ;-)")))
  48. (when (< 0 (length (match-string-no-properties 15)))
  49. (erc-send-message (concat nick ": " "别。。俺真不是同志 :-(")))
  50. (when (< 0 (length (match-string-no-properties 16)))
  51. (erc-send-message (concat ": " "在这里谈雨淋麻风的, 要被tjjtds lol http://forum.ubuntu.org.cn/viewtopic.php?f=95&t=267605 ;-)")))
  52. )))
  53.  
  54. (add-hook 'erc-insert-post-hook 'ibot-hello)

提交下面的校正或者修改. (点击这里开始一个新的帖子)
姓名: 在 cookie 中记住我的名字

屏幕抓图:(jpeg 或 png)