File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
scalabot-ext-example/src/main/java/net/lamgc/scalabot/simple Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -37,11 +37,16 @@ public Ability sayHello() {
3737 */
3838 public Ability test () {
3939 ReplyFlow botHello = ReplyFlow .builder (bot .db ())
40+ .enableStats ("say_hello" )
4041 .action ((bot , upd ) -> bot .silent ().send ("What is u name?" , upd .getMessage ().getChatId ()))
41- .onlyIf (update -> "hello" .equalsIgnoreCase (update .getMessage ().getText ()))
42+ .onlyIf (update -> update .hasMessage ()
43+ && update .getMessage ().hasText ()
44+ && "hello" .equalsIgnoreCase (update .getMessage ().getText ()))
4245 .next (Reply .of ((bot , upd ) -> bot .silent ()
4346 .send ("OK! You name is " + upd .getMessage ().getText ().substring ("my name is " .length ()), upd .getMessage ().getChatId ()),
44- upd -> upd .getMessage ().getText ().startsWith ("my name is " )))
47+ upd -> upd .hasMessage ()
48+ && upd .getMessage ().hasText ()
49+ && upd .getMessage ().getText ().startsWith ("my name is " )))
4550 .build ();
4651
4752 return Ability .builder ()
You can’t perform that action at this time.
0 commit comments