本文整理汇总了Java中com.ullink.slack.simpleslackapi.SlackSession.findChannelByName方法的典型用法代码示例。如果您正苦于以下问题:Java SlackSession.findChannelByName方法的具体用法?Java SlackSession.findChannelByName怎么用?Java SlackSession.findChannelByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ullink.slack.simpleslackapi.SlackSession
的用法示例。
在下文中一共展示了SlackSession.findChannelByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLastWeeksMessages
import com.ullink.slack.simpleslackapi.SlackSession; //导入方法依赖的package包/类
private List<SlackMessagePosted> getLastWeeksMessages() {
SlackSession slackSession = getSlackSession();
SlackChannel slackChannel = slackSession.findChannelByName("publicaties");
ChannelHistoryModule channelHistoryModule = ChannelHistoryModuleFactory.createChannelHistoryModule(slackSession);
List<SlackMessagePosted> lastWeeksMesages = IntStream.of(7, 6, 5, 4, 3, 2, 1)
.mapToObj(daysAgo -> LocalDate.now().minus(daysAgo, ChronoUnit.DAYS))
.flatMap(date -> getMessagesOfDay(slackChannel, channelHistoryModule, date))
.collect(toList());
try {
slackSession.disconnect();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
return lastWeeksMesages;
}
示例2: process
import com.ullink.slack.simpleslackapi.SlackSession; //导入方法依赖的package包/类
@Override
public boolean process(String command, SlackMessagePosted event, SlackSession session)
{
Matcher matcher = PUBLISH_REVIEW_PATTERN.matcher(command);
if (matcher.matches())
{
String channelNameToPublish = matcher.group(1);
String changeId = matcher.group(2);
String comment = matcher.group(3);
SlackChannel channel = session.findChannelByName(channelNameToPublish);
if (channel != null)
{
executor.execute(new PublishMessageJob(channelNameToPublish, event.getChannel(), changeId.trim(), comment, session, reviewRequestService, subscriptionService, gerritChangeInfoService, changeInfoDecorator));
}
return true;
}
return false;
}
示例3: triggerFinalized
import com.ullink.slack.simpleslackapi.SlackSession; //导入方法依赖的package包/类
@Override
public void triggerFinalized(Trigger trigger) {
SlackSession session = SlackSessionFactory.createWebSocketSlackSession(token);
try {
session.connect();
} catch (IOException e) {
LOG.error(e.getMessage());
}
SlackChannel channel = session.findChannelByName(this.channel);
session.sendMessage(channel, "Data Provider has finished.");
}