Skip to content

Commit

Permalink
Move the tiny-url code to after checking if the source is from a bot.
Browse files Browse the repository at this point in the history
Also, make it match a "bot" suffix case insensitively.
  • Loading branch information
elibarzilay committed Jul 22, 2011
1 parent 2525f35 commit 5166ffb
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions irc-process-line.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,9 @@
;; is (unbox *my-nick*) -- recorded in the sightings log.
(when (not (equal? target (unbox *my-nick*)))
(espy target #f (cons first-word rest)))
;; look for long URLs to tiny-ify, but only if we're The
;; Original Rudybot, so avoid annoying duplicates from multiple
;; bots
(when (regexp-match? #rx"^rudybot" (unbox *my-nick*))
(for ((word (in-list (cons first-word rest))))
(match word
[(regexp url-regexp (list url _ _))
(when (<= 75 (string-length url))
(pm target
"~a"
(make-tiny-url url)))]
[_ #f])))

(cond
[(regexp-match? #rx"bot$" nick)
[(regexp-match? #rx"[Bb]ot$" nick)
(log "nick '~a' ends with 'bot', so I ain't gonna reply. Bot wars, you know."
nick)]
[(equal? target (unbox *my-nick*))
Expand All @@ -231,6 +219,16 @@
(parameterize ([*full-id* full-id])
(do-cmd nick nick (cons first-word rest) #:rate_limit? #f))]
[else
;; look for long URLs to tiny-ify, but only if we're The
;; Original Rudybot, so avoid annoying duplicates from multiple
;; bots
(when (regexp-match? #rx"^rudybot" (unbox *my-nick*))
(for ((word (in-list (cons first-word rest))))
(match word
[(regexp url-regexp (list url _ _))
(when (<= 75 (string-length url))
(pm target "~a" (make-tiny-url url)))]
[_ #f])))
(when (and (regexp-match? #rx"^(?i:let(')?s)" first-word)
(regexp-match? #rx"^(?i:jordanb)" nick))
(log "KOMEDY GOLD: ~s" (cons first-word rest)))
Expand Down

0 comments on commit 5166ffb

Please sign in to comment.