如何在 TelegramBots 库 (Java) 中使用 AbilityBot 固定消息?
How to pin message using AbilityBot in TelegramBots library (Java)?
我在 google 和图书馆的文档中进行了搜索,但没有找到。
official TelegramBots library docs
我需要这样的:
public Ability sayHelloWorld() {
return Ability
.builder()
.name("hello")
.info("says hello world!")
.locality(ALL)
.privacy(PUBLIC)
.action(ctx -> {
Message msg = silent.send("Hello world!", ctx.chatId()).get();
// example of method which i can't find
silent.pin(msg.getChatId(), msg.getMessageId())
})
.build();
}
我找到了如何做到这一点:
sendApiMethodAsync(PinChatMessage.builder()
.chatId(msg.getChatId().toString())
.messageId(msg.getMessageId())
.build())
要取消固定消息,请使用 UnpinChatMessage。
我在 google 和图书馆的文档中进行了搜索,但没有找到。
official TelegramBots library docs
我需要这样的:
public Ability sayHelloWorld() {
return Ability
.builder()
.name("hello")
.info("says hello world!")
.locality(ALL)
.privacy(PUBLIC)
.action(ctx -> {
Message msg = silent.send("Hello world!", ctx.chatId()).get();
// example of method which i can't find
silent.pin(msg.getChatId(), msg.getMessageId())
})
.build();
}
我找到了如何做到这一点:
sendApiMethodAsync(PinChatMessage.builder()
.chatId(msg.getChatId().toString())
.messageId(msg.getMessageId())
.build())
要取消固定消息,请使用 UnpinChatMessage。