summaryrefslogtreecommitdiffstats
path: root/lib/IM/Engine/Plugin/Commands/Command/Help.pm
blob: 24cc464fc827eea39ddc22d69409a02efdc71567 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package IM::Engine::Plugin::Commands::Command::Help;
use IM::Engine::Plugin::Commands::OO;

has '+help' => (
    default => 'Displays the help text for the given command',
);

sub default {
    my $self = shift;
    my ($sender, $action) = @_;
    $self->is_active(0);
    my $prefix = $self->_ime_plugin->prefix;
    my $last_message = $self->_ime_plugin->_last_message;
    my $message = $last_message->meta->clone_object(
        $last_message,
        message   => "${prefix}$action -help",
        plaintext => "${prefix}$action -help",
    );
    return $self->_ime_plugin->incoming($message);
}

1;