Ignore:
Timestamp:
12/09/10 07:01:43 (14 years ago)
Author:
nanardon
Message:
  • support chat command help from POD
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Model/Help/POD.pm

    r62 r102  
    55use Pod::POM; 
    66use Pod::POM::View::HTML; 
     7use Pod::POM::View::Text; 
    78 
    89extends 'Catalyst::Model'; 
     
    3132    return values %{ $self->{pom} } 
    3233} 
     34 
     35sub bot_functions { 
     36    my ($self) = @_; 
     37    my $botpom = $self->{pom}{'Chat::Cmd'}; 
     38    foreach my $head1 ($botpom->content) { 
     39        $head1->title eq 'AVAILLABLE FUNCTIONS' or next; 
     40        return map { $_->title } $head1->content; 
     41    } 
     42} 
     43 
     44sub bot_help_text { 
     45    my ($self, $cmd) = @_; 
     46    my $botpom = $self->{pom}{'Chat::Cmd'}; 
     47    foreach my $head1 ($botpom->content) { 
     48        $head1->title eq 'AVAILLABLE FUNCTIONS' or next; 
     49        foreach ($head1->content) { 
     50            $_->title =~ /^\Q$cmd\E( |$)/ or next; 
     51            my $ppvt = Pod::POM::View::Text->new; 
     52            return $_->present($ppvt); 
     53        } 
     54        last; 
     55    } 
     56    return; 
     57} 
     58 
    3359 
    3460sub xmlrpc_functions { 
Note: See TracChangeset for help on using the changeset viewer.