예제 #1
0
  @HookHandler
  public void onChat(ChatHook hook) {
    if (uhcChat == null) {
      uhcChat = hook.getChat();
    }

    if (hook.getChat() != uhcChat) {
      return;
    }
    if (hook.getMessage().startsWith(">")) {
      return;
    }

    for (String m : hook.getMessage().split("\n")) {
      SkypeBot.log(m);
      sendMessage("#ultrahardcore", ">" + hook.getSenderDisplayName() + ": " + m);
    }
  }
예제 #2
0
 @Override
 public void onMessage(
     String channel, String sender, String login, String hostname, String message) {
   if (uhcChat == null) {
     return;
   }
   if (message.startsWith("# ")) {
     return;
   }
   try {
     uhcChat.send(">" + sender + ": " + message);
   } catch (SkypeException e) {
     SkypeBot.log("Could not send message! (Not hooked into Skype?");
   }
   if (message.startsWith(SkypeBot.getSettingValue("commandPrefix"))) {
     String[] splitMessage = message.split(" ");
     String[] parameters = Arrays.copyOfRange(splitMessage, 1, splitMessage.length);
     String command = splitMessage[0].replaceFirst(SkypeBot.getSettingValue("commandPrefix"), "");
     CommandContainer cc = new CommandContainer(parameters, sender, command, uhcChat);
     SkypeBot.cmds().executeCommand(cc);
   }
 }