refactor(example): say_hello 命令添加用户的账号信息.

补充账号信息, 方便查(为了测试).

P.S. 其实这个 Commit 应该算作 feat, 但这个是示例扩展, 所以就改成了 refactor.
This commit is contained in:
LamGC 2022-03-15 15:15:34 +08:00
parent 22a824377a
commit de83d2c3d3
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -23,7 +23,12 @@ public class SayHelloExtension implements AbilityExtension {
.info("Say hello to you.") .info("Say hello to you.")
.privacy(Privacy.PUBLIC) .privacy(Privacy.PUBLIC)
.locality(Locality.ALL) .locality(Locality.ALL)
.action(ctx -> ctx.bot().silent().send("Hello! " + ctx.user().getUserName(), ctx.chatId())) .action(ctx -> {
String msg = "Hello! " + ctx.user().getUserName() +
" ( " + ctx.user().getId() + " ) [ " + ctx.user().getLanguageCode() + " ]" + "\n" +
"Current Chat ID: " + ctx.chatId();
ctx.bot().silent().send(msg, ctx.chatId());
})
.build(); .build();
} }