Created
May 23, 2012 10:36
-
-
Save richo/2774499 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env csi -s | |
; Shitty irc bot, for the lulz | |
; | |
; Chicken internals | |
(use posix) | |
; Externals | |
(use openssl) | |
; Devious internals | |
(require "lib/irc_internals") | |
(require "lib/helpers") | |
; (define (_debug) void) | |
(define (load-config) | |
void | |
) | |
(define devious-server "irc.psych0tik.net") | |
(define devious-port 6697) | |
(define devious-ssl #t) | |
(load-config) | |
(define (set-output o) | |
(define output o) | |
) | |
(define (output line) | |
(write-line (string-join line "\n") o) | |
) | |
(define (handle-line line) | |
; Catch PING's early and handle | |
(if (ping? line) (output (pong line))) | |
(_debug line) | |
) | |
(define (_loop i o) | |
(handle-line (read-line i)) | |
(_loop i o) | |
) | |
; Setup and initialization | |
(define (enter i o) | |
; Any module registration etc should happen here. | |
(set-output o) | |
(_loop i o) | |
) | |
(define (main) | |
(_debug "Started") | |
(apply enter (ssl-connect devious-server devious-port)) | |
) | |
(main) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment