本文整理汇总了Java中org.telegram.abilitybots.api.objects.MessageContext类的典型用法代码示例。如果您正苦于以下问题:Java MessageContext类的具体用法?Java MessageContext怎么用?Java MessageContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageContext类属于org.telegram.abilitybots.api.objects包,在下文中一共展示了MessageContext类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canSayHelloWorld
import org.telegram.abilitybots.api.objects.MessageContext; //导入依赖的package包/类
@Test
public void canSayHelloWorld() {
Update mockedUpdate = mock(Update.class);
EndUser endUser = EndUser.endUser(USER_ID, "Abbas", "Abou Daya", "addo37");
MessageContext context = MessageContext.newContext(mockedUpdate, endUser, CHAT_ID);
bot.saysHelloWorld().action().accept(context);
// We verify that the sender was called only ONCE and sent Hello World to CHAT_ID
Mockito.verify(sender, times(1)).send("Hello World!", CHAT_ID);
}
示例2: commitTo
import org.telegram.abilitybots.api.objects.MessageContext; //导入依赖的package包/类
/**
* Commits to DB.
*
* @param db the database to commit on
* @return a lambda consumer that takes in a {@link MessageContext}, used in post actions for abilities
*/
public static Consumer<MessageContext> commitTo(DBContext db) {
return ctx -> db.commit();
}