[project @ 2002-07-12 03:27:05 by unknown_lamer]
[clinton/bobotpp.git] / scripts / stupid_stuff / stupid_stuff
index acf452f..35f29bd 100644 (file)
 ;;; yes, this uses a sql db!
 (use-modules (database simplesql)
             (ice-9 debug))
-(load "../bobot-utils.scm")
+(load "../bobot:utils.scm")
 
 ;;; Activate or desactivate the bot
 (define talk 1)
 
 (define (shutup)
   (set! talk 0))
-(bot-addcommand "shutup" shutup #f 0 2)
+(bot:addcommand "shutup" shutup #f 0 2)
 
 (define (dotalk)
   (set! talk 1))
-(bot-addcommand "talk" dotalk #f 0 2)
+(bot:addcommand "talk" dotalk #f 0 2)
 
 
 ;;; Miscellaneous list functions
 ;;; When someone joins a channel
 (define dumbTimer (list))
 (define (joinLourd n c)
-  (if (string-ci=? n (bot-getnickname))
+  (if (string-ci=? n (bot:getnickname))
     (begin
-      (if (= 1 talk) (bot-say c "I like limos"))
+      (if (= 1 talk) (bot:say c "I like limos"))
       (set! dumbTimer 
-           (addChannel c (bot-addtimer (+ 600 (bot-random 300)) 
+           (addChannel c (bot:addtimer (+ 600 (bot:random 300)) 
                                        (dumbLourd c)) dumbTimer)))
-    (if (= 1 talk) (bot-say c (string-append "Arf Moo Arf! " n
+    (if (= 1 talk) (bot:say c (string-append "Arf Moo Arf! " n
                                             " I like pizza...")))))
-(bot-addhook hooks/join ".*" joinLourd)
+(bot:addhook hooks/join ".*" joinLourd)
 
 ;;; When someone leaves the channel
 (define (partLourd n c)
-  (bot-flushport)
-  (if (not (string-ci=? n (bot-getnickname)))
-      (if (= 1 talk) (bot-msg n "I HATED YOU ANYWAY"))
+  (bot:flushport)
+  (if (not (string-ci=? n (bot:getnickname)))
+      (if (= 1 talk) (bot:msg n "I HATED YOU ANYWAY"))
       (let* ((timer (assoc c dumbTimer)))
-        (bot-deltimer (cadr timer))
+        (bot:deltimer (cadr timer))
         (set! dumbTimer (removeChannel c dumbTimer)))))
-(bot-addhook hooks/part ".*" partLourd)
+(bot:addhook hooks/part ".*" partLourd)
 
 ;;; Random action to say something dumb
  (define (dumbLourd c)
    (lambda ()
    (if (= 1 talk) 
-     (bot-say 
+     (bot:say 
       c 
-      (vector-ref (list-ref dumbList (bot-random (length dumbList))) 0)))
+      (vector-ref (list-ref dumbList (bot:random (length dumbList))) 0)))
    (set! dumbTimer 
        (changeChannel 
         c
-        (bot-addtimer (+ 600 (bot-random 300)) (dumbLourd c)) dumbTimer))))
+        (bot:addtimer (+ 600 (bot:random 300)) (dumbLourd c)) dumbTimer))))
 
 
 (define dumbDB (simplesql-open 'postgresql "bot_sayings"))
 ;(define dumbList #f)
 ; (define (reload-sayings)
 ;   (set! dumbList (cdr (simplesql-query dumbDB "SELECT saying FROM sayings")))
-;   (display "Reloaded sayings from db\n" (bot-logport))
-;   (bot-flushport))
-; (bot-addcommand "reloadsayings" reload-sayings #f 0 4)
+;   (display "Reloaded sayings from db\n" (bot:logport))
+;   (bot:flushport))
+; (bot:addcommand "reloadsayings" reload-sayings #f 0 4)
 ; (reload-sayings)
 
 (define (_length db)
 
 
 (define (random-saying)
-  (vector-ref (_select dumbDB (bot-random (_length dumbDB))) 0))
+  (vector-ref (_select dumbDB (bot:random (_length dumbDB))) 0))
 
 ;;; Misc
 ;;; note that public hooks match the channel name too!
 ;;; match-not-channel prevents this
 
 ;;; this should be the first so it doesn't clobber the other hooks
-(bot-addhook 
+(bot:addhook 
  hooks/public (match-to-me "")
  (lambda (f t p)
    (if (= 1 talk)
-     (bot-say t
+     (bot:say t
              (string-append f ": " (random-saying))))) -50 #f)
 
 
-(bot-addhook hooks/public (match-not-channel "oracle")
+(bot:addhook hooks/public (match-not-channel "oracle")
             (lambda (f t p) 
               (if (= 1 talk) 
-                (bot-say t "Oracle is evil! Use Postgres instead!"))))
+                (bot:say t "Oracle is evil! Use Postgres instead!"))))
 
 (define (add-gnu word)
-  (bot-addhook hooks/public (match-not-channel word)
+  (bot:addhook hooks/public (match-not-channel word)
             (lambda (f t p) 
               (if (= 1 talk)
-                (bot-say t 
+                (bot:say t 
                          (string-append f ": I hope you meant GNU!"))))))
 (map add-gnu '("[^/g]linux" "microsoft" "bsd"))
 
-(bot-addhook hooks/public (match-not-channel "boulet")
+(bot:addhook hooks/public (match-not-channel "boulet")
             (lambda (f t p) 
-              (if (= 1 talk) (bot-say t "on parle de moi ?"))))
+              (if (= 1 talk) (bot:say t "on parle de moi ?"))))
 
-(bot-addhook hooks/public (match-not-channel "arf")
+(bot:addhook hooks/public (match-not-channel "arf")
             (lambda (f t p) 
               (if (= 1 talk) 
-                (bot-say t (random-saying)))))
+                (bot:say t (random-saying)))))
 
-(bot-addhook hooks/public (match-not-channel "csn")
+(bot:addhook hooks/public (match-not-channel "csn")
             (lambda (f t p) 
-              (if (= 1 talk) (bot-say t "???"))))
+              (if (= 1 talk) (bot:say t "???"))))
 
-(bot-addhook hooks/public (match-not-channel "pizza|pasta|soda")
+(bot:addhook hooks/public (match-not-channel "pizza|pasta|soda")
             (lambda (f t p)
               (if (= 1 talk) 
-                (bot-say t (string-append f ": give me one too!")))))
+                (bot:say t (string-append f ": give me one too!")))))
 
 (define (add-foul word)
-  (bot-addhook hooks/public (match-not-channel word)
+  (bot:addhook hooks/public (match-not-channel word)
             (lambda (f t p) 
               (if (= 1 talk)
-                (bot-action 
+                (bot:action 
                  t (string-append "hits " f 
                                   " for having a potty mouth"))))))
 (map add-foul '("bitch" "fuck" "whore" "cunt" "tit" "shit" "dick" "cock"))
 
-(bot-addhook hooks/public (match-not-channel "anal sex")
+(bot:addhook hooks/public (match-not-channel "anal sex")
             (lambda (f t p) 
               (if (= 1 talk)
                 (if (not (string-match "unknown_lamer" f))
-                  (bot-action 
+                  (bot:action 
                    t (string-append "grabs " f 
                                     " and buggers " f " up the ass"))))))
 
-(bot-addhook 
+(bot:addhook 
  hooks/public (match-not-channel "[[:space:]]*lame[[:space:]]+")
  (lambda (f t p)
    (if (= 1 talk)
-     (bot-say t
+     (bot:say t
              (string-append f ": NO NO YOU ARE THE LAMER")))))
 
-(bot-addhook hooks/public (match-to-me "burn")
+(bot:addhook hooks/public (match-to-me "burn")
             (lambda (f t p)
               (if (= 1 talk)
-                (bot-say
+                (bot:say
                  t
                  (string-append "How about you burn " f "?")))))
             
 ;(define (newDay l)
 ;  (if (not (null? l))
 ;      (begin
-;        (bot-say (caar l) "What is up my homey g-d0g?")
+;        (bot:say (caar l) "What is up my homey g-d0g?")
 ;        (newDay (cdr l))
 ;        )
 ;      )
 ;)
 
-;(bot-addhook hooks/timer "09:00" (lambda (h) (newDay dumbTimer) (talk)))
+;(bot:addhook hooks/timer "09:00" (lambda (h) (newDay dumbTimer) (talk)))
 
 ;;; 18h00, il est temps de rentrer
 ;(define (timeToGo l)
 ;  (if (not (null? l))
 ;      (begin
-;        (bot-say (caar l) "Give me food")
-;        (bot-action (caar l) "I'm bored")
+;        (bot:say (caar l) "Give me food")
+;        (bot:action (caar l) "I'm bored")
 ;        (timeToGo (cdr l))
 ;        )
 ;      )
 ;)
-;(bot-addhook hooks/timer "18:00" (lambda (h) (timeToGo dumbTimer) (shutup)))
\ No newline at end of file
+;(bot:addhook hooks/timer "18:00" (lambda (h) (timeToGo dumbTimer) (shutup)))
\ No newline at end of file