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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.