Skip to content

Added callback argumentes for say() #1

Merged
merged 1 commit into from Mar 18, 2013

2 participants

@xaicron
xaicron commented Mar 16, 2013

I want get response data from say().
In the case on lingr2irc, Cannot be determined a received message from the IRC or any other client.

I'll want cache message.id, And lookup it in on_event callback.

For example:

my $sent_message = {};

$lingr->say('perl_jp', 'Hi!', sub {
    my $res = shift;
    $sent_message->{ $res->{message}{id} } = 1;
});

$lingr->on_event(sub {
    my $event = shift;
    if ($msg = $event->{message}) {
        if ($sent_message->{ $msg->{id} }) {
            # this message was sent from myself
            return;
        }
        ...
    }
});

thanks.

@typester typester merged commit 97336bd into typester:master Mar 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.