Fellow Perl Monks, I pray for your wisdom

I want to write a slack bot which will perform certain services for me, however, I can't even get the most basic example (the one from the module) to work.

I installed Bot::Backbone::Service::SlackChat, and copied the example verbatim, except for putting in my own API key, which I got from slack.

package EzopBot; use Bot::Backbone; service slack_chat => ( service => 'SlackChat', token => 'xoxb-297...etc...', # see slack.com for your token +s + ); service dice => ( service => 'OFun::Dice', ); service "general_chat" => ( service => 'GroupChat', chat => 'SlackChat', group => 'C', dispatcher => 'general_dispatch', ); dispatcher 'general_dispatch' => as { redispatch_to "dice"; }; __PACKAGE__->new->run;

When I try to run this code, all I get back is no such chat as SlackChat

If I try to step through code, I can see that the SlackChat service seems allocated:

DB<1> n Bot::Backbone::Bot::run(/home/matija/perl5/lib/perl5/Bot/Backbone/Bot. +pm:63): 63: $self->construct_services; DB<1> n Bot::Backbone::Bot::run(/home/matija/perl5/lib/perl5/Bot/Backbone/Bot. +pm:64): 64: $_->initialize for ($self->list_services); DB<1> x $self->list_services 0 Bot::Backbone::Service::GroupChat=HASH(0x513af70) 'bot' => EzopBot=HASH(0x507f3b8) 'event_loop' => 'POE::Kernel' 'services' => HASH(0x5187830) 'dice' => Bot::Backbone::Service::OFun::Dice=HASH(0x5076150) 'bot' => EzopBot=HASH(0x507f3b8) -> REUSED_ADDRESS 'name' => 'dice' 'general_chat' => Bot::Backbone::Service::GroupChat=HASH(0x51 +3af70) -> REUSED_ADDRESS 'slack_chat' => Bot::Backbone::Service::SlackChat=HASH(0x509b +468) '_message_queue' => ARRAY(0x5155fd0) empty array 'bot' => EzopBot=HASH(0x507f3b8) -> REUSED_ADDRESS 'chat_consumers' => ARRAY(0x5160f98) empty array 'last_mark' => 0 'name' => 'slack_chat' 'token' => 'xoxb-29790832193-ZvnekL1EZmyAa0LH4vgSBDL7' 'chat_consumers' => ARRAY(0x5080240) empty array 'chat_name' => 'SlackChat' 'dispatcher_name' => 'general_dispatch' 'group' => 'C' 'name' => 'general_chat' 1 Bot::Backbone::Service::OFun::Dice=HASH(0x5076150) -> REUSED_ADDRESS 2 Bot::Backbone::Service::SlackChat=HASH(0x509b468) -> REUSED_ADDRESS

so I conclude the driver routines get loaded, and something else is going wonky.

Would be grateful for any clues


In reply to Anybody got a clue why my slack bot won't work? by matija

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.