Skip to content

quickSave() and quickSaveNext() method #4

@tanftw

Description

@tanftw

Save current or next message to database without using callback.

Currently, to save current message, we use:

$bot->answer('@email', function($bot, $user_id, $input) {
    $bot->storage->set($user_id, 'email', $input);
    $bot->say('Your message has been saved');
});

With quick save, it simpler

Save current message to email field:

$bot->answer('@email', 'Your message has been saved')->quickSave();

Users can also save current message to different field name by passing field name to quickSave() method:

$bot->answer('@email, 'Your message has been saved')->quickSave('user_email');

Instead of save current message, user can save next message:

// Next message is email
$bot->answer('%license%', 'Please enter your email')->quickSaveNext();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions