コード例 #1
0
 @Override
 public void run() {
   try {
     if (!gerritChangeInfoService.projectExists(projectId)) {
       session.sendMessage(
           channelToSubscribe,
           "Could not find project name *`"
               + projectId
               + "`*, check that this project name is valid and that it is active",
           null,
           SlackChatConfiguration.getConfiguration().asUser());
       return;
     }
     subscriptionService.unsubscribeOnProject(projectId, channelToSubscribe.getId());
     session.sendMessage(
         channelToSubscribe,
         "This channel will not publish any more review requests from project *`"
             + projectId
             + "`*",
         null,
         SlackChatConfiguration.getConfiguration().asUser());
   } catch (IOException e) {
     session.sendMessage(
         channelToSubscribe,
         "Too bad, an unexpected error occurred...",
         null,
         SlackChatConfiguration.getConfiguration().asUser());
     e.printStackTrace();
   }
 }
コード例 #2
0
 @Override
 public void sendMessage(String message) {
   slackSession.sendMessage(slackChannel, message, null);
 }