cb21075d |
1 | ;;; Activate or desactivate the bot |
2 | (define talk 1) |
3 | (define (shutup) |
4 | (set! talk 0) |
5 | ) |
439869bf |
6 | (bot:addcommand "shutup" shutup #f 0 2) |
cb21075d |
7 | (define (dotalk) |
8 | (set! talk 1) |
9 | ) |
439869bf |
10 | (bot:addcommand "talk" dotalk #f 0 2) |
cb21075d |
11 | |
12 | ;;; Miscellaneous list functions |
13 | (define (removeChannel c l) |
14 | (if (null? l) |
15 | (list) |
16 | (let ((deb (car l))) |
17 | (if (string-ci=? c (car deb)) |
18 | (cdr l) |
19 | (append (list deb) (removeChannel c (cdr l))) |
20 | ) |
21 | ) |
22 | ) |
23 | ) |
24 | |
25 | (define (changeChannel c n l) |
26 | (if (null? l) |
27 | (list) |
28 | (let ((deb (car l))) |
29 | (if (string-ci=? c (car deb)) |
30 | (append (list (list c n)) (cdr l)) |
31 | (append (list deb) (changeChannel c n (cdr l))) |
32 | ) |
33 | ) |
34 | ) |
35 | ) |
36 | |
37 | (define (addChannel c n l) |
38 | (append l (list (list c n))) |
39 | ) |
40 | |
41 | ;;; When someone joins a channel |
42 | (define dumbTimer (list)) |
43 | (define (joinLourd n c) |
439869bf |
44 | (if (string-ci=? n (bot:getnickname)) |
cb21075d |
45 | (begin |
439869bf |
46 | (if (= 1 talk) (bot:say c "salut les gars, vous parlez de quoi ?")) |
47 | (set! dumbTimer (addChannel c (bot:addtimer (+ 600 (bot:random 3000)) (dumbLourd c)) dumbTimer)) |
cb21075d |
48 | ) |
439869bf |
49 | (if (= 1 talk) (bot:say c (string-append "euh humm euh..., " n "... une ptite question..."))) |
cb21075d |
50 | ) |
51 | ) |
439869bf |
52 | (bot:addhook hooks/join ".*" joinLourd) |
cb21075d |
53 | |
54 | ;;; When someone leaves the channel |
55 | (define (partLourd n c) |
439869bf |
56 | (bot:flushport) |
57 | (if (not (string-ci=? n (bot:getnickname))) |
58 | (if (= 1 talk) (bot:msg n "hey, reviens, on s'amusait bien")) |
cb21075d |
59 | (let* ((timer (assoc c dumbTimer))) |
439869bf |
60 | (bot:deltimer (cadr timer)) |
cb21075d |
61 | (set! dumbTimer (removeChannel c dumbTimer)) |
62 | ) |
63 | ) |
64 | ) |
439869bf |
65 | (bot:addhook hooks/part ".*" partLourd) |
cb21075d |
66 | |
67 | ;;; Random action to say something dumb |
68 | (define dumbList |
69 | (list "errr... umm umm !!" |
70 | "ahum. err... p'tite question !" |
71 | "putain, php c'est vraiment de la merde" |
72 | "quelle daube mysql !" |
73 |