(module vandusen-spam () (import chicken scheme) (use vandusen irc sql-de-lite) (plugin 'spam (lambda () (define paste-db-file (or (and ($ 'paste-db-file) (car ($ 'paste-db-file))) "/var/awful/pastiche/pastiche.db")) (command 'spam '(: "spam" (+ space) (submatch (= 40 alnum))) ;; our sha1 hashes are 40 chars long (lambda (master hash) (cond ((file-exists? paste-db-file) (let* ((db (open-database paste-db-file)) (deleted-entries (begin (exec (sql db "delete from searchable where hash=?") hash) (exec (sql db "update pastes set author='spam', title='Deleted Spam', paste='

This paste has been deleted as spam.

Please be more careful where you click in future.

' where hash=?") hash)))) (if (zero? deleted-entries) (reply-to master "Could not find an entry with that hash") (reply-to master (format "I have deleted ~a paste(s) with hash ~a successfully." deleted-entries hash))) (close-database db))) (else (reply-to master (format "Cannot find database at ~a" paste-db-file))))) public: #f))))