GithubHelp home page GithubHelp logo

irclj's Introduction

irclj

Irclj is a very simple IRC library for Clojure. It is entirely asynchronous and callback-based. It has been a WIP for quite a while (I don't have a ton of time to spend on it), but it is entirely functional and is being used by some projects already. Just don't be surprised if it's missing a feature that might seem common place. Good news is that the infrastructure to easily add features is there.

Usage

https://clojars.org/irclj

Note that this is still a work in progress. Some things may not work, or obvious things may be missing. Check out the issue tracker to see what needs to be done, and please contribute if you can!

user=> (require '[irclj.core :as irc])
nil
user=> (def connection (irc/connect "irc.freenode.net" 6667 "hotbot" :callbacks {:privmsg (fn [irc type s] (prn irc type s))}))
#'user/connection
user=> (irc/join connection "#4clojure")
nil
user=> (irc/kill connection)
nil
user=> (def connection (irc/connect "irc.freenode.net" 6667 "hotbot" :callbacks {:privmsg (fn [irc type & s] (prn irc type s))}))
#'user/connection
user=> (irc/join connection "#4clojure")
nil
...say something in-channel...
<buncha shit gets printed>

Irclj is callback based, so you can register callbacks on any kind of IRC protocol message, including the numeric messages. Most of the time you're going to want to capture PRIVMSG as demonstrated above though. Check out events.clj and process.clj.

For a larger, but also simple example of a working bot, check out this fellow's bot: https://github.com/boxed/atpshowbot

License

Licensed under the EPL, same as Clojure itself.

irclj's People

Contributors

amalloy avatar cmatheson avatar dlowe avatar emlyn avatar jneen avatar raynes avatar suvash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

irclj's Issues

join channels with private key

It seems it is not possible to join channels with a private key.
works if the ":" is removed. but i assume that is not a good idea in the long run.

Add an :on-error handler

To complement the new optional error-catching stuff, provide an :on-error handler so that people can do special stuff when errors occur.

Connection timeouts

Right now, Irclj does absolutely nothing when a connection is dropped. It doesn't know anything about it. We need to make sure that disconnects can be handled properly.

Handle mode changes

IRC's mode changing syntax is complicated, but I think we should try listening for MODE changes and update info in the irc map accordingly. The reason I'd like to do this is because Irclj is callback based, so you can't just 'fetch' modes and then receive them. You'd need to have a callback, which doesn't fit most workflows.

Document the IRC ref

The IRC ref contains many goodies... Let the users know what is stored there!

Restructure

Irclj is need of a restructure. Some things need renamed, and some things just need factored into other namespaces. This will allow for more reusability.

Add a disconnected event

We need to monitor the connection and fire a hook when the bot disconnects. This will allow for implementing reconnecting.

Allow more flexibility with connection output.

Right now, connection output is always printed to stdout. We need to allow more flexibility. We need the option of writing it to other places, such as files, and the option of not writing it anywhere at all.

Implement flood limits.

Internal support for limiting the number of outgoing messages in a specific time-frame would be very useful.

Channel keys are not saved anywhere

Channel keys should be stored in the :channels map if they exist. That way, users have a way of knowing whether or not they're in a private channel without having to remember it themselves.

[Not a issue]

Hi! How i can send message in irc channel with irclj?

Tests

Irclj's tests are old, non-working, never were complete, and need to be rewritten.

Allow CTCP responses to be user defined.

Right now, all CTCP responses are embedded. They're mostly just comical responses with little meaning. They should be user-definable with sane, serious defaults.

Clean up connect.

It's unclean, and stuff like pinging should be moved into the normal handling stuff. Need to also make sure we're not being stupid with the initial stuff we send on connecting.

No matching method found: createSocket

I'm trying to connect to an IRC server (actually, Slack with IRC gateway enabled) and I'm getting the following error:

vinyl.core> (irc/connect host port nick :pass password :ssl? true)

IllegalArgumentException No matching method found: createSocket for class sun.security.ssl.SSLSocketFactoryImpl  clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)

I'm using:

  • clojure 1.8.0
  • irclj 0.5.0-alpha4
  • OpenJDK 1.8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.