Skip to content

Instantly share code, notes, and snippets.

@spazm
Created January 10, 2012 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spazm/1591106 to your computer and use it in GitHub Desktop.
Save spazm/1591106 to your computer and use it in GitHub Desktop.
Bot::Backbone jabber example
#!/usr/bin/perl
package Example::Bot::Backbone::Jabber;
use strict;
use warnings;
use v5.10;
use Bot::Backbone;
use DateTime;
#modified from Bot::Backbone synopsis
my $domain = 'chat.example.com';
my $group_domain = 'conference.' . $domain;
my $username = 'guest';
my $password = 'guest';
my $group = 'test_room';
service jabber_chat => (
service => 'JabberChat',
domain => $domain,
group_domain => $group_domain,
username => $username,
password => $password,
);
service "group_\$group" => (
service => 'GroupChat',
group => $group,
chat => 'jabber_chat',
dispatcher => 'group_chat',
);
dispatcher group_chat => as {
# Report the bot's time
command '!time' =>
respond { DateTime->now->format_cldr('ddd, MMM d, yyyy @ hh:mm:ss') };
};
my $bot = Example::Bot::Backbone::Jabber->new;
$bot->run;
@spazm
Copy link
Author

spazm commented Jan 10, 2012

simple Bot::Backbone jabber bot that connects to a group_chat. Replies to group message "!time" with the current time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment