Welcome to the CHICKEN Scheme pasting service
vandusen-spam plugin added by sjamaan on Tue Feb 23 11:24:54 2021
(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 "delete from pastes 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))))