Code Monkey home page Code Monkey logo

net--irc's People

Contributors

japhb avatar jnthn avatar jpve avatar moritz avatar perlpilot avatar timbus avatar zoffixznet avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

net--irc's Issues

Async

Readme says:

It's currently in active development, but it is mostly stable until perl 6 implements either threads or async I/O so it can work correctly as a bot (timed events and things that block the runtime are not possible yet.)

That's from 2010. It seems like all of that stuff works quite well on MoarVM (or at least it is good enough!).

I need timed events…

Getting going?

Hi I'm trying to write a simple bot using your library. The example code you give has a typo at: Net::IRC::DefaultHandlers.new() should be Net::IRC::Handlers::Default.new() after I fixed this I still get an error with the Event class not having a .reply(). Has everything changed since your documentation? Any help you can pass along would be much appreciated. I'll try using the source, in the meantime :) Thanks for your efforts on this! Using a grammar appears to be a really clean mechanism for creating libraries of this kind! Exciting stuff.

No such method 'reply' for invocant of type 'Net::IRC::Event'
in method joined at ./echo.p6:17
in sub METAOP_HYPER_CALL at src/gen/CORE.setting:11943
in block at lib/Net/IRC/Bot.pm:163
in method reify at src/gen/CORE.setting:5186
in method reify at src/gen/CORE.setting:5088
in method reify at src/gen/CORE.setting:5088
in method gimme at src/gen/CORE.setting:5466
in method eager at src/gen/CORE.setting:5445
in method eager at src/gen/CORE.setting:1099
in sub eager at src/gen/CORE.setting:5730
in method do_dispatch at lib/Net/IRC/Bot.pm:161
in block at lib/Net/IRC/Bot.pm:146
in method dispatch at lib/Net/IRC/Bot.pm:115
in method run at lib/Net/IRC/Bot.pm:89
in block at ./echo.p6:29

The panda info for your library reads:

PROJECT LIST:
"Net::IRC::Bot" => "0.9"
"State" => "installed"
"Source-url" => "git://github.com/TiMBuS/Net--IRC.git"
"Description" => "An IRC bot framework"
INSTALLED VERSION:
"depends" => []
"description" => "An IRC bot framework"
"name" => "Net::IRC::Bot"
"source-revision" => "99e638d"
"source-type" => "git"
"source-url" => "git://github.com/TiMBuS/Net--IRC.git"
"version" => "0.9"

Your example with my modification looks like (echo.p6):

!/usr/bin/env perl6

use Net::IRC::Bot;

#Roles can let you break up large event handler modules into smaller ones.
role ExtraAnnoying {
has %enemies = ('bob', 'sam', 'chanserv') X=> 1;
#Magical type constraints only let this event be called when $e.who is an enemy
multi method said ($e where {.who ~~ %enemies}) {
$e.reply($e.msg); #Parrot back what was said;
}
}

class AnnoyUsers does ExtraAnnoying {
#Will be called when the bot gets a join event
multi method joined ($e) {
$e.reply("Hi there, {$e.who}!");
}
}

Net::IRC::Bot.new(
nick => 'blargh',
server => 'irc.ivixor.net',
channels => <#bots>,

    modules  => (
            Net::IRC::Handlers::Default.new(),
            AnnoyUsers.new(), 
    ),

).run;

Can't use CommandHandler for custom modules

Like the title says, for some reason I can't make CommandHandler work with a module of my own. Trying to write my own kind of 8-ball as an example, if I make my own said multimethod that will work (of course using nextsame to get to the CommandHandler anyway), but the CommandHandler's dispatcher doesn't. For now I'll have to workaround by essentially doing command handling manually.

It's also worth noting that using the supplied modules works as expected, so it really is just a problem with using CommandHandler myself.

Here's some example code:

class Foobar does Net::IRC::CommandHandler {
    my @replies = "a", "b", "bar";

    multi method cueball($ev, $match) is cmd {
        $ev.msg("{$ev.who}: {@replies.pick}");
    }
}

Please specify the license

I cannot find it, it looks like the license is not specified at all.

I kinda expect GPL or AGPL, but I understand that Artistic License (or more like a disjunction of Artistic and GPL) is somewhat preferred in perl community. Any license is fine as long as it is specified.

Thanks!

Modules are broken

It seems like all of the modules are broken. f063741 introduces is cmd, which in turn breaks all existing code.

What was

method command_tell ( $ev, $match ) {

should now be written as

method tell ( $ev, $match ) is cmd {

This, however, is not necessarily the best move. I've tried fixing it, but method 8ball starts with a digit (which is not a valid name). Also, Help.pm still relies on command_ prefixes.

I don't really get it. This change was made more than a year ago, how come the code base is not adapted?

“Nothing to dispatch” warning when using multiple modules

It seems like if you are using more than one module that is using CommandHandler you will be getting pointless “Nothing to dispatch” warnings (command exists, but in another module. Therefore CommandHandler of the current module decides to throw a warning).

Possible workaround is to use inheritance and smash everything into one module. I don't really want to do that though.

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.