| 1 | package Bot::Backbone::Bot::Role::GroupChat; | ||
| 2 | $Bot::Backbone::Bot::Role::GroupChat::VERSION = '0.161950'; | ||
| 3 | use v5.10; | ||
| 4 | use Moose::Role; | ||
| 5 | |||
| 6 | use List::Util qw( first ); | ||
| 7 | |||
| 8 | use namespace::autoclean; | ||
| 9 | |||
| 10 | # ABSTRACT: Provides some group related help tools | ||
| 11 | |||
| 12 | |||
| 13 | sub list_group_names { | ||
| 14 | my $self = shift; | ||
| 15 | return map { $_->group } | ||
| 16 | grep { $_->isa('Bot::Backbone::Service::GroupChat') } | ||
| 17 | $self->list_services; | ||
| 18 | } | ||
| 19 | |||
| 20 | |||
| 21 | sub find_group { | ||
| 22 | my ($self, $name) = @_; | ||
| 23 | return first { $_->isa('Bot::Backbone::Service::GroupChat') | ||
| 24 | and $_->group eq $name } $self->list_services; | ||
| 25 | } | ||
| 26 | |||
| 27 | 1; | ||
| 28 | |||
| 29 | __END__ |