Giter Club home page Giter Club logo

lazybot's Introduction

lazybot

lazybot is an IRC bot written in Clojure. Under the hood, it uses irclj for talking to IRC. The bot is highly extensible via plugins. Plugins are written in Clojure, using a lightweight DSL. There are already plugins for tons of stuff, including Haskell and Clojure code evaluation, googling, and using the bot as an operator bot. You can view all of the plugins in src/lazybot/plugins.

The project aims to create what will eventually be a user-friendly and powerful IRC bot. Whereas clojurebot is mostly aimed at providing helpful services in the #clojure IRC channel, lazybot is focused on being generally useful to people who aren't Clojurians. However, lazybot also provides Clojure code evaluation, and is used by some Clojurians in their respective IRC channels primarily for that purpose.

Usage

Several of this bot's plugins require that you have MongoDB installed and running. The core plugins that currently do are mail, whatis, macro, seen, help, fortune and karma. You can find some quickstart guides for setting up MongoDB here: http://www.mongodb.org/display/DOCS/Quickstart. It's usually pretty painless and fast.

As for what OSes this bot actually runs on: I have no clue. I've seen it run on several Ubuntu distros and OS X, but nobody (that I know of) has yet to venture into the world of lazybot-on-windows. If you do, please let me know how it goes.

The easiest way to get the bot going is to pull the repository, install leiningen, and run lein deps. Additionally, you will need MongoDB installed (in some future version, this will be an optional dependency). Edit .lazybot/config.clj to put the servers and other information the bot needs to have in there, get MongoDB running, and then run ./lazybot. After you run the bot the first time, you'll have to edit configuration in ~/.lazybot/config.clj (the .lazybot directory is copied to your home directory the first time).

You can also run lein uberjar which will create a standalone jar file for you to use to run the bot. You can just do java -jar jarfile to run it.

Lazybot has some basic background functionality. In order to use it, you must have lazybot uberjar'd. Create a file with any name. This will be your log file, where all the output from the bot is put. Next, rename lazybot--standalone.jar to lazybot.jar (this step will become unnecessary soon). After that, run java -jar lazybot.jar --background --logpath /path/to/your/logfile. lazybot will then start up and pump logs into the log file. Note however that this is NOT daemon functionality. If you start the bot this way, in order to kill him, you'll have to use the admin-only die command from the utils plugin, or look up the process id and kill him the low-level way. I may add full daemon functionality eventually, but this will suffice for now.

IMPORTANT: If you load the clojure plugin, you must rename and move "example.policy" to "~/.java.policy" to avoid some troublesome security errors!

Commands

The current list of commands is maintained at https://github.com/flatland/lazybot/wiki/Commands, and you can find help on any particular command with $help (eg $help fcst).

Development

Contributions to lazybot are welcome, most often in the form of new plugins. If you have a great idea for something lazybot could do that would be useful or neat, don't just sit on it: Write a plugin, and send a pull request! But before you get started, take a look at our plugin policy and the plugin quick-start guide. If you want to see how much work it takes to write a plugin, take a look at a couple plugins added by developers not on the core team:

License

Licensed under the same thing Clojure is licensed under, the EPL. You can find a copy in the root of this directory.

Contributors

These are people who have contributed to lazybot since the beginning. These may not all be active contributors. Even one-off contributors will be added to this list.

lazybot's People

Contributors

amalloy avatar aphyr avatar bhiles avatar bltavares avatar brandonbloom avatar brehaut avatar bronsa avatar causal-agent avatar erik avatar gfredericks avatar ghoseb avatar hackervera avatar hugoduncan avatar hypirion avatar ivey avatar jcolechanged avatar jeremyheiler avatar joshrotenberg avatar mattdeboard avatar mecdemort avatar nbeloglazov avatar ninjudd avatar noisesmith avatar nukemberg avatar pepijndevos avatar raynes avatar tobias 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lazybot's Issues

Get rid of all the multi-protocol related crap

Multi-protocol lazybot was a poor idea. It's better that we focus on IRC. Besides, the Twitter experiment was a huge failure that I don't even want to talk about. Some of this code still exists in hidden places, while not effecting anything. We should eliminate all of this dead code.

findfn doesn't sandbox interop properly

Haven't tried it as the exploit isn't entirely trivial, but I suspect that users can use $findfn to call arbitrary java code. Need to look at making clojail.core/dotify public.

Redesign configuration

Right now, our configuration is a mess. Plugins just do whatever the hell they want with the configuration file and nothing is standard. Besides that, half of our keys don't make any sense.

I propose the following configuration conventions/guidelines:

  • A plugin should never have configuration keys in the top level of the configuration file. Instead, they should have their configuration in a key named after the plugin. For example: {:clojure {:prepends ..}}. This should be true regardless of whether or not a plugin only has a single configuration key. It needs to be standardized. There is no way to enforce it, but we can certainly encourage it.
  • Plugins should document their configuration keys. I will create a plugin description file and being documenting the existing plugins.
  • Plugins should never die if configuration is not set. It is okay to fail if it is set incorrecly, but only if it would be inconvenient to die gracefully. It should never die because a key simply isn't set.
  • A huge problem with our configuration is that you have a top-level :plugins key and one for every server. This is ugly and inconvenient. It makes more sense for each server to have a :plugins key, but not a top level key. lazybot should be intelligent enough to know what to do here, and there should be a way for 'all' plugins to be loaded without copying them each and every time or wrapping the configuration in a let.

Easy deploy @ heroku free plan (with MongoHQ).

Currently I do not know how to setup java.policy file @ heroku.
When I eval some code, then bot give me...

  • java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)

Can we avoid this step, even at the cost of the unsecured bot?

  • IMPORTANT: If you load the clojure plugin, you must rename and move "example.policy" to "~/.java.policy" to avoid some troublesome security errors!

A plugin for creating github issues

The idea would be to configure repositories and people who are allowed to use those repos and allow those people to create issues from within IRC. We need a better permission system first, but we could implement this without it.

Lein uberjar trouble because deps include snapshots

When running

lein uberjar

I get the response

Compiling lazybot.run
Compilation succeeded.
Release versions may not depend upon snapshots.
Freeze snapshots to dated versions or set the LEIN_SNAPSHOTS_IN_RELEASE environment variable to override this.

And no uberjar is created.

I believe this is due to one of the dependencies being hobbit "0.1.0-SNAPSHOT"

sexpbot shouldn't store stuff in the IRC refs

While it may be a bit more annoying to do, we should be passing around a ref that contains the IRC ref and can be modified with configuration information and stuff. What we're doing now is just plain dirty.

a nice way to chain lazybot commands

Like $foo bar && $baz quux or something. The challenging part is getting a syntax that isn't insane but also doesn't clash with normal commands.

shorturl plugin doesn't work for bitly

The shorturl plugin doesn't appear to be working for bitly, but it does appear to be working for isgd.

Here are some commands and the responses:

@shorten bitly http://google.com
-- No response -- 

@expand http://bit.ly/LmvF
-- No response -- 

@shorten isgd http://google.com
http://is.gd/5JJNDX

@expand http://is.gd/5JJNDX
http://google.com

@shorten none http://google.com
No URL shortener by that name was found.

a plugin for restarting the bot

Slightly complicated because if you fork the JVM, you end up with a logless bot. The restart command would need to make the bot log to a file.

Centralize configuration

We need to figure out a way to centralize reading of the configuration file. We load it here there and everywhere, and it isn't consistent. If we have it loaded in a single place (the IRC ref), we'll be able to access it on the fly, and when we reload the bot, the configuration will be reloaded as well. We can also reload the configuration and not the whole bot at a single time, and we can expect it to Do The Right Thing most of the time.

clojurebot-like factoids to replace the whatis plugin

Challenging because coming up with a syntax is difficult. Your first inclination is to allow for factoid commands/queries to be like lazybot: foo is bar but that doesn't really work in lazybot. The problem is that command prefixes are arbitary strings. This means that lazybot: can actually be a command prefix in which case whatever foo is could be a command, in which case the commands and hooks would clash. I guess one option here is to modify the command/hook system so that hooks only trigger if a command isn't also triggered, but I don't want to do that. I think that the best compromise here is to just make the factoid system be a command.
e.g.

$fact foo is bar
$whatis foo

Give the sed plugin some TLC

Automatic sed is cute, but it annoys people. Let's make this automatic behavior configurable and off by default.

Listen for #NNN and reply with link/description for corresponding issue

Each channel should have a GitHub repo where Lazybot would look up references to issues and reply with a description and link.

Perhaps initially it would only be triggered by direct requests to lazybot:

<technomancy> lazybot: #732
<lazybot> preview8 can't find clojure/tools/nrepl/server.clj when trampolined - https://github.com/technomancy/leiningen/issues/732

It could respond to inline issue references as well using a syntax that's less likely to be triggered accidentally; perhaps ##732.

A more specific reference like Raynes/lazybot#77 would allow you to refer to an issue other than the channel's primary repository.

Help isn't working

Help isn't working properly. Whenever you try to get help, it always looks up help in the topics, rather than return help for the specific command you're trying to use.

Connection timeouts

Right now, Irclj does absolutely nothing when the connection times out except go into a coma. We need a way to make connections timeout, and know when we've disconnected in order to handle disconnects the right way.

Rework the plugin loading code

The way lazybot loads plugins is bizarre and buggy. For example, loading a plugin from IRC doesn't work if the plugin wasn't already required at lazybot's startup. This is silly. Fix it.

fix issues with the Github plugin

There is some strange bug that is causing the Github plugin to fail if the bot hasn't been reloaded at least once after starting up on my and Alan's VPS (the primary lazybot instance). I've been having some issues with ports that have kept me from reproducing things locally, but Alan plans to try to reproduce it soon.

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.

Time tracking

It'd be cool to have some sort of time tracking integrated with the bot. Possibly integrated with a service like toggl or harvest.

It would be able to do the following:

  • Start and stop a timer for a task with a name.
  • Tell you how long you've been working on something.
  • Give you analytics about what you've done in a given time frame. Today, yesterday, this week, last week, this month, last month, February 25 -> August 14th, etc.

Make login also work with hostnames.

Currently, you always have to login. This isn't always necessary, as some people have relatively constant and unique hostnames. The hostnames could be used rather than traditional login for some people, and would in turn kill the need for some admins to login all the time.

A better permission system

We should improve the login system to make it possible to expand on permissions. I think this capability might already exist, but we should definitely make it easy to use.

extend and improve the permission system

Right now, all we can do with the permission system is declare users to be either admin or regular user. We need to expand this out and improve it so that we can have an extensible system capable of very specific permissions. This way we can have sets of permissions for users that plugins can add to and check for as well as two basic permissions:

  • user: for regular users
  • admin: for administrators who are trusted with the scariest commands.

The idea is that it would be possible to give certain non-admin users more dangerous and specialized permissions. For example, a plugin foo could check for its own special permission, like permission foo.

Use hobbit for URL shortening

Replace the shorturl plugin with one that uses hobbit and is intelligent. Also, add a generic is-gd shortening function to lazybot.utilities for usage in plugins and other lazybot code.

More Github integration

Some ideas:

  • Issues
    • View contents of issue.
    • Number of issues.
    • Open/close issues?
      • This might be plausible if bot instance x has its own Github account and is made a collaborator on Github. You wouldn't want to allow authentication with Github from IRC unless you used oauth2. If you used basic auth, you'd be able to see the passwords via console logging.
    • Alert when issue is created.

Embeddable code eval

It would be neat if there was a way to embed evaluation in a message.

<Raynes> Well, you could always do &|(println "blah")|&

The &||& used is just an example.

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.