Code Monkey home page Code Monkey logo

diggler's Introduction

Diggler dub

Diggler is an IRC bot framework for the D programming language.

Please report bugs and requests to the issue tracker. Thanks!

Directory Structure

  • src - the Diggler source files.
  • visuald - VisualD project files.
  • lib - Diggler library files (when built).

Dependencies

Diggler depends on Dirk which depends on libev. For Debian and deriviates, that's the libev-dev package.

You can find automatically generated documentation on the gh-pages branch, or you can browse it online.

License

Diggler is licensed under the terms of the MIT license (see the LICENSE file for details).

diggler's People

Contributors

jakobovrum avatar mitchgrout avatar philpax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

diggler's Issues

Error: module bot is in file 'diggler/bot.d' which cannot be read

Hi,

I came across your framework and thought on giving it a try but for some odd reason I am getting "Error: module bot is in file 'diggler/bot.d' which cannot be read" but the file is readable and does exist.

Compiling...
source/app.d(1): Error: module bot is in file 'diggler/bot.d' which cannot be read
import path[0] = source
import path[1] = ../../../darius/.dub/packages/diggler-master/dirk
import path[2] = ../../../darius/.dub/packages/diggler-master/dirk/libev
import path[3] = ../../../darius/.dub/packages/dirk-master
import path[4] = ../../../darius/.dub/packages/dirk-master/libev
import path[5] = /usr/include/dmd/phobos
import path[6] = /usr/include/dmd/druntime/import

Any idea?

Options for commands

A command such as !time may require several options: One to add, another to remove, and one to show. They may be called by !time add [nick] [zone], !time remove [nick], and !time [nick]. Currently, to implement this, you may do something like

void time(string[] args...){
    switch(args[0].toLower){
        case "add": ... break;
        case "remove": ... break;
        default: ... break;
    }
}

My suggestion is to define multiple functions which state which option they accept, delimited by an underscore

void time_add(string nick, string zone){ ... }
void time_remove(string nick){ ... }
void time(string nick){ ... }

In addition to better code readability, this change would make the options for a command more visible when using !help.

Issues with overloading methods in CommandSet classes

When a function is overloaded in a CommandSet class, the following error is produced and compilation fails:
~/.dub/packages/diggler-master/src/diggler/command.d(431): Error: cannot infer type from overloaded function symbol &cmdSet.Echo
Error is produced from the following code.

class TestCommands : CommandSet!TestCommands {
    mixin CommandContext!();
    public void Echo(){
        Echo("This is a test");
    }

    private void Echo(string input){
        reply(input);
    }
}
.....
bot.registerCommands(new TestCommands);

onNickInUse not working as intended

Using the example code found here http://jakobovrum.github.io/Diggler/index.html , if I connect to an IRC serer (tested on Rizon & Esper) where the nick is already in use, the client sends "NICK *_" instead of the original nick with an appended underscore.
Log from running with "debugVersions": ["Dirk"]

":irc.losslessone.com 433 * mitch_ :Nickname is already in use." pos: 318
<< "NICK *" (length: 7)
":irc.losslessone.com 432 * *
:Erroneous Nickname" pos: 369
Unhandled command "432"

Suggestion for help command

For the default help command, I suggest that it echoes only the added command sets, instead of echoing every command set and their commands on a separate line. This will avoid flooding a channel if a large number of command sets have been added to the bot. The help command should also be modified so you can ask for help for a specific command set, and get the commands it defines.

Static assert unittest failure in dirk tracker

Test bot code that triggers this issue

import diggler.bot;
import irc.client;
import irc.eventloop;

void main()
{
    Bot.Configuration conf;
    conf.nickName = "foo";
    conf.userName = "foo";
    conf.realName = "foo";
    conf.commandPrefix = "!";

    Bot bot = new Bot(conf);
    IrcClient client = bot.connect("irc://foo");

    client.onNickInUse ~= badNick => badNick ~ "_";
    client.onConnect ~= delegate void() { client.join("#foo"); };

    bot.eventLoop.postTimer(delegate void() { client.send("#foo", "Hi!"); }, 1.0, IrcEventLoop.TimerRepeat.yes);

    bot.run();
}

Built with:

dub build --build=unittest

Build failure message:

../../.dub/packages/dirk-master/irc/tracker.d(452): Error: static assert  (is(CustomTrackedChannel!void == CustomTrackedChannel!(UserInfo))) is false
../../.dub/packages/diggler-master/src/diggler/tracker.d(15):        instantiated from here: CustomIrcTracker!(UserInfo)
FAIL ../../.dub/packages/diggler-master/.dub/build/library-unittest-linux.posix-x86_64-dmd_2066-7DC1260DB7DE0CFE87BD4B2292C2DD2B/ diggler staticLibrary

Everything runs fine if just built in debug mode though.

Issue with variadic arguments

If a variadic function is called with no arguments, it will error instead of calling the function with an empty array.

@usage("Choose from two or more items separated by spaces")
public void choose(string[] arg...){
    import std.random;
    if(arg.length<2) reply("Need at least two arguments");     
    else reply("Result: %s", arg[uniform(0, arg.length)]);
}

If `choose is called with no arguments, it will respond

error: got 0 argument(s), expected at least 1 for command "choose"

instead of

Need at least two arguments

Generalize admin system

For example, the same authentication mechanism could be used to separate users into access levels.

allowPMCommands not working as intended

The Diggler bot will still accept commands through private message even if allowPMCommands is explicitly set to false.
Using the example code found here http://pastebin.com/bazpL0AU , run the bot, and /msg DebugBot !echo foobar
The bot will respond as it normally would in a channel, which it should not.

Using a password?

Hi,

it seems it's not possible in the crurent code of diggler/dirk to join a network with an account that has a password. Am I missing something? A github code search only brings up dirk's "join channel with a password".

Thanks!

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.