v0.5.1 rolling: PING works as expected
This commit is contained in:
parent
b86a6a98c6
commit
301cf74470
3 changed files with 12 additions and 4 deletions
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>loper</groupId>
|
<groupId>loper</groupId>
|
||||||
<artifactId>InnaIrcBot</artifactId>
|
<artifactId>InnaIrcBot</artifactId>
|
||||||
<version>0.5-SNAPSHOT</version>
|
<version>0.5.1-SNAPSHOT</version>
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>InnaIrcBot</name>
|
<name>InnaIrcBot</name>
|
||||||
|
|
|
@ -2,6 +2,7 @@ package InnaIrcBot.Commanders;
|
||||||
|
|
||||||
import InnaIrcBot.ProvidersConsumers.StreamProvider;
|
import InnaIrcBot.ProvidersConsumers.StreamProvider;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -55,6 +56,9 @@ public class CTCPHelper {
|
||||||
if (current.isValid(currentTime)){
|
if (current.isValid(currentTime)){
|
||||||
chanelOrUser = current.getRequesterChanelOrUser(whoReplied);
|
chanelOrUser = current.getRequesterChanelOrUser(whoReplied);
|
||||||
if ( chanelOrUser != null && current.getType().equals(whatReplied.replaceAll("\\s.*$", ""))) {
|
if ( chanelOrUser != null && current.getType().equals(whatReplied.replaceAll("\\s.*$", ""))) {
|
||||||
|
if (whatReplied.equals("PING inna"))
|
||||||
|
StreamProvider.writeToStream(serverReplied, "PRIVMSG " + chanelOrUser + " :" + whoReplied + ": " + Duration.between(current.getCreationTime(), currentTime).toMillis()+"ms");
|
||||||
|
else
|
||||||
StreamProvider.writeToStream(serverReplied, "PRIVMSG " + chanelOrUser + " :" + whoReplied + ": " + whatReplied);
|
StreamProvider.writeToStream(serverReplied, "PRIVMSG " + chanelOrUser + " :" + whoReplied + ": " + whatReplied);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
|
@ -110,7 +114,6 @@ class CtcpRequest {
|
||||||
this.notFoundMessage = notFoundMessage;
|
this.notFoundMessage = notFoundMessage;
|
||||||
this.CTCPtype = CTCPType;
|
this.CTCPtype = CTCPType;
|
||||||
}
|
}
|
||||||
String getType(){ return CTCPtype; }
|
|
||||||
String getRequesterChanelOrUser(String userResponds){ // return channel name
|
String getRequesterChanelOrUser(String userResponds){ // return channel name
|
||||||
if (userResponding.equals(userResponds))
|
if (userResponding.equals(userResponds))
|
||||||
return requesterChanelOrUser;
|
return requesterChanelOrUser;
|
||||||
|
@ -120,6 +123,11 @@ class CtcpRequest {
|
||||||
boolean isValid(LocalDateTime currentTime){
|
boolean isValid(LocalDateTime currentTime){
|
||||||
return currentTime.isBefore(initiatedTime.plusSeconds(5));
|
return currentTime.isBefore(initiatedTime.plusSeconds(5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getType(){ return CTCPtype; }
|
||||||
|
|
||||||
|
LocalDateTime getCreationTime(){ return initiatedTime; }
|
||||||
|
|
||||||
String getNotFoundMessage(String userResponds){
|
String getNotFoundMessage(String userResponds){
|
||||||
if (this.userResponding.equals(userResponds))
|
if (this.userResponding.equals(userResponds))
|
||||||
if (notFoundMessage.isEmpty())
|
if (notFoundMessage.isEmpty())
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package InnaIrcBot;
|
package InnaIrcBot;
|
||||||
|
|
||||||
public class GlobalData {
|
public class GlobalData {
|
||||||
private static final String version = "InnaIrcBot v0.5 \"Шикотан\"";
|
private static final String version = "InnaIrcBot v0.5.1 \"Шикотан\"";
|
||||||
public static synchronized String getAppVersion(){
|
public static synchronized String getAppVersion(){
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue