本文整理汇总了Java中com.linecorp.bot.model.event.source.GroupSource类的典型用法代码示例。如果您正苦于以下问题:Java GroupSource类的具体用法?Java GroupSource怎么用?Java GroupSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GroupSource类属于com.linecorp.bot.model.event.source包,在下文中一共展示了GroupSource类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: textTextGroup
import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
@Test
public void textTextGroup() throws IOException {
parse("callback/text-group.json", callbackRequest -> {
assertThat(callbackRequest.getEvents()).hasSize(1);
Event event = callbackRequest.getEvents().get(0);
assertThat(event).isInstanceOf(MessageEvent.class);
assertThat(event.getSource())
.isInstanceOf(GroupSource.class);
assertThat(event.getSource().getUserId())
.isNull();
MessageEvent messageEvent = (MessageEvent) event;
assertThat(messageEvent.getReplyToken())
.isEqualTo("nHuyWiB7yP5Zw52FIkcQobQuGDXCTA");
MessageContent message = messageEvent.getMessage();
assertThat(message).isInstanceOf(TextMessageContent.class);
});
}
示例2: getId
import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
public String getId(Source source){
String id=null;
String type=null;
if (source instanceof GroupSource) {
id = ((GroupSource) source).getGroupId();
type="group";
} else if (source instanceof RoomSource) {
id = ((RoomSource) source).getRoomId();
type="room";
} else{
id = source.getUserId();
type="personal";
}
return id;
}
示例3: getType
import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
public String getType(Source source){
String type = null;
if (source instanceof GroupSource)
type="group";
else if(source instanceof RoomSource)
type="room";
else
type="personal";
return type;
}
示例4: testJoin
import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
@Test
public void testJoin() throws IOException {
parse("callback/join.json", callbackRequest -> {
assertThat(callbackRequest.getEvents()).hasSize(1);
Event event = callbackRequest.getEvents().get(0);
assertThat(event).isInstanceOf(JoinEvent.class);
assertThat(event.getSource())
.isInstanceOf(GroupSource.class);
assertThat(((GroupSource) event.getSource()).getGroupId())
.isEqualTo("cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
assertThat(event.getTimestamp())
.isEqualTo(Instant.parse("2016-05-07T13:57:59.859Z"));
});
}
示例5: testLeave
import com.linecorp.bot.model.event.source.GroupSource; //导入依赖的package包/类
@Test
public void testLeave() throws IOException {
parse("callback/leave.json", callbackRequest -> {
assertThat(callbackRequest.getEvents()).hasSize(1);
Event event = callbackRequest.getEvents().get(0);
assertThat(event).isInstanceOf(LeaveEvent.class);
assertThat(event.getSource())
.isInstanceOf(GroupSource.class);
assertThat(((GroupSource) event.getSource()).getGroupId())
.isEqualTo("cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
assertThat(event.getTimestamp())
.isEqualTo(Instant.parse("2016-05-07T13:57:59.859Z"));
});
}