GithubHelp home page GithubHelp logo

bot-basicbot-pluggable-fromconfig's Introduction

NAME

Bot::BasicBot::Pluggable::FromConfig - Create a bot from a config file.

SYNOPSIS

use Bot::BasicBot::Pluggable::FromConfig;

my $bot = Bot::BasicBot::Pluggable::FromConfig->new_with_config(
    config => {name => 'my_bot', path => 'some/path'},
);

DESCRIPTION

Bot::BasicBot::Pluggable::FromConfig is a config loader for Bot::BasicBot::Pluggable allowing all of your Bot configuration to be declared in its own file. It is largely based on Bot::BasicBot::Pluggable::WithConfig. It's designed to allow for a wider degree of flexibility with its range of accepted config files.

FromConfig uses Config::JFDI to load a config based on the name supplied to the config argument. This allows pretty much any config style you want and also allows for a '_local' file to override on a per-instance bases if you need.

Running a Bot

This library provides a command line script called run_bot. This provides a complete implementation of this module. Documentation can be found there.

Alternatively you can create your own implementation of this in your own scripts. The simplest method is to call new_with_config() and pass it a config name and then call run on the returned Bot object.

METHODS

new_with_config( config => 'my_bot' )

This is the only method provided in this module beyond those described in Bot::BasicBot::Pluggable. It accepts a hash as its arguments which must contain a config key. This key can either be the name of the config sans extension (which will be passed as the name param to Config::JFDI) or a hashref of params to pass through to Config::JFDI.

A new Bot::BasicBot::Pluggable::FromConfig object which inherits from Bot::BasicBot::Pluggable is returned.

Config Keys

All attributes accepted by the constructor of Bot::BasicBot::Pluggable and thus Bot::BasicBot are valid configuration items.

plugins

An arrayref of plugins are also accepted:

{
    "channels": ["#perl"],
    "plugins": [
        {
            "module": 'Karma',
            "config": {
                "karma_change_reponse": 0
            },
        },
        {
            "module": "Bot::BasicBot::Pluggable::Module::Auth",
        },
}

Each should provide at minimum the name of the Module that implements the plugin. This can either be the full qualified name (Bot::BasicBot::Pluggable::Module::Name) or just the qualifying module name.

A config hashref can also be specified and these items will be passed to the plugin objects set() method.

KNOW ISSUES

There is known issue in Bot::BasicBot::Pluggable when using more recent version of Perl and POD::Checker. This will cause it to fail its t/release-pod-syntax test (https://rt.cpan.org/Public/Bug/Display.html?id=89806). Users should --force install B::BB::P before installing this module.

SEE ALSO

Config::JFDI

Bot::BasicBot::Pluggable

LICENSE

Copyright (C) Mike Francis.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Mike Francis [email protected]

bot-basicbot-pluggable-fromconfig's People

Contributors

ungrim97 avatar

Watchers

 avatar  avatar

bot-basicbot-pluggable-fromconfig's Issues

Any::Moose is deprecated

Tests fail because of a new deprecation notice in Any::Moose:

...
Any::Moose is deprecated. Please use Moo instead at /opt/perl-5.25.7/lib/site_perl/5.25.7/Config/JFDI.pm line 11.

#   Failed test 'no (unexpected) warnings (via done_testing)'
#   at t/01-config_json.t line 68.
# Looks like you failed 1 test of 3.
t/01-config_json.t .. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests 
...

Tests fail (if JSON::DWIW is installed?)

On some of my smokers I see the following failure:

#   Failed test 'No tests run for subtest "Config - Name only"'
#   at t/01-config_json.t line 36.
Error parsing ./test.json: JSON::DWIW v0.47 byte 82, char 82, line 5, col 8 (byte col 8) - syntax error at /opt/perl-5.24.0/lib/site_perl/5.24.0/Config/Any/JSON.pm line 56.
 at /opt/perl-5.24.0/lib/site_perl/5.24.0/Config/JFDI/Source/Loader.pm line 104.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 2.
t/01-config_json.t .. 
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 1/2 subtests 

This seems to happen only if JSON::DWIW is installed.

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.