10000 GitHub - mpenet/ash: Simple, extensible irc bot based on pircbotx
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mpenet/ash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Ash

Cute bot

It's a robot. Ash is a god damn robot!

A simple IRC bot, based on pircbotx, started as a fork of clj-irc.

Why another one?

Because I need one that works with grove.io, that is very simple, extensible, supports webhooks and has some simple persistance solution embedded.

See plugins for examples. You can add your own event listeners by extending the qbits.ash.bot/listen multimethod.

See echoweb for a basic example of webhook integration.

Installation

[cc.qbits/ash "0.2.6"]

Usage

(require
  '[qbits.ash :as ash]
  '[qbits.ash.webhooks :as webhooks]

  '[qbits.ash.plugins.clojure :as clj]
  '[qbits.ash.plugins.google :as goog]
  '[qbits.ash.plugins.echoweb :as echoweb])

(-> (ash/make-bot :server-password "meh"
                  :nick "just-a-bot"
                  :name "just-a-bot"
                  :password "1234"
                  :host "meh.irc.grove.io"
                  :port 6667
                  :channels ["#foo" "#bar"]
                  :auto-reconnect true)
    clj/handler
    goog/handler
    echoweb/handler)

(webhooks/start-server)

Plugins

Plugins are very easy to implement:

(ns yourbot.plugins.meh
    (:require [qbits.ash :as ash]))

(defn handler
  [bot]
  (ash/listen bot :on-message
      (fn [event]
          (when (re-find #"sayhi" (:content event))
              ;; reply knows about context form the event passed
              ;; (privmsg, channel msg, etc)
              (ash/reply bot event "Hello world"))))))

For a webook:

(defn handler [bot]
  (ash/listen bot :on-webhook
              :post #"^/say-hi"
              (fn [request]
                (ash/send-message "#somechan" "hohai")))

  (ash/listen bot :on-webhook
              :get #"^/say-hi-foo"
              (fn [request]
                (ash/send-message "foo" "hohai foo")))

Clojure plugin: clojail sandboxing

Because clojail employs the JVM's built in sandboxing, you'll need to have a ~/.java.policy file to define permissions for your own code. If you don't do this, you'll get security exceptions.

You can find an example here.

License

Copyright © 2012 FIXME

Distributed under the Eclipse Public License, the same as Clojure.

About

Simple, extensible irc bot based on pircbotx

Resources

Stars

Watchers

Forks

Packages

No packages published
0