本文整理匯總了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();
}