File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed
Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change 22
33use Alisa \Alisa ;
44use Alisa \Context ;
5+ use Alisa \Sessions \Session ;
6+ use Alisa \Types \Button ;
57
68require __DIR__ . '/../vendor/autoload.php ' ;
79
8- $ alisa = new Alisa ;
10+ $ alisa = new Alisa ([
11+ 'buttons ' => [
12+ 'incrementAndDecrement ' => [
13+ new Button ('- ' , 'decrement ' ),
14+ new Button ('+ ' , 'increment ' ),
15+ ],
16+ ],
17+ ]);
918
1019$ alisa ->onStart (function (Context $ ctx ) {
11-
20+ $ ctx ->reply (
21+ 'Счетчик: ' . Session::get ('counter ' , 0 ),
22+ buttons: 'incrementAndDecrement '
23+ );
1224});
1325
14- $ alisa ->onAny (function (Context $ ctx ) {
26+ $ alisa ->onAction ('increment ' , function (Context $ ctx ) {
27+ $ ctx ->reply (
28+ 'Счетчик: ' . Session::increment ('counter ' ),
29+ buttons: 'incrementAndDecrement '
30+ );
31+ });
1532
33+ $ alisa ->onAction ('decrement ' , function (Context $ ctx ) {
34+ $ ctx ->reply (
35+ 'Счетчик: ' . Session::decrement ('counter ' ),
36+ buttons: 'incrementAndDecrement '
37+ );
1638});
1739
1840$ alisa ->run ();
You can’t perform that action at this time.
0 commit comments