Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Anybody got a clue why my slack bot won't work?

by matija (Priest)
on Mar 27, 2016 at 15:57 UTC ( #1158880=perlquestion: print w/replies, xml ) Need Help??
matija has asked for the wisdom of the Perl Monks concerning the following question:

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1158880]
Approved by Corion
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2018-07-23 02:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (459 votes). Check out past polls.

    Notices?