示例#1
0
 @Override
 public void parse(Message m) {
   String target = m.param();
   if (!m.param().startsWith("#")) target = m.sender();
   if (m.trailing().equals("TIME")) {
     String time =
         String.format(
             "%s %02d:%02d:%02d ",
             LocalDate.now().toString(),
             LocalTime.now().getHour(),
             LocalTime.now().getMinute(),
             LocalTime.now().getSecond());
     m.notice(m.sender(), String.format("TIME %s", time));
   }
   if (m.command().equals("PRIVMSG")) {
     if (m.botCommand().equals("time")) {
       if (m.hasBotParams()) {
         for (int i = 0; i < m.botParamsArray().length; i++) {
           m.pm(m.botParamsArray()[i], "TIME");
           requests.put(m.botParamsArray()[i], target);
         }
       }
     }
   }
   if (m.command().equals("NOTICE")) {
     if (requests.containsKey(m.sender())) {
       if (m.trailing().startsWith("TIME")) {
         String version = m.trailing().substring(5, m.trailing().length() - 1);
         Server.say(requests.get(m.sender()), "[" + m.sender() + "] Current Time: " + version);
         requests.remove(m.sender());
       }
     }
   }
 }
示例#2
0
  @Override
  public void parse(Message m) {
    String target = m.param();
    if (!m.param().startsWith("#")) target = m.sender();

    if (m.botCommand().equals("pastatopic")) {
      if (Info.hasUserInfo(m.sender())) {
        if (Info.getChannelInfo("#pasta").has(m.sender())) {
          if (Info.getChannelInfo("#pasta").getModes(m.sender()).contains("~")
              || Info.getChannelInfo("#pasta").getModes(m.sender()).contains("&")) {
            topicmain = m.botParams();
            write();
          } else Server.say(target, "You need to be at least AOP to use this command");
        }
      }
    }
    if (m.command().equals("TOPIC")) {
      if (m.param().equals("#pasta")) {
        if (!m.trailing().startsWith(topicmain)) {
          Server.send("TOPIC #pasta :" + topicmain + " " + m.trailing());
        }
      }
    }
  }