Added Functionality
This commit is contained in:
parent
f678e1f91e
commit
e00794dbe4
Binary file not shown.
Binary file not shown.
|
@ -45,14 +45,18 @@ public static boolean testingMode = true;
|
|||
@Override
|
||||
public void onMessageReceived(MessageReceivedEvent event) {
|
||||
Message msg = event.getMessage();
|
||||
MessageChannel channel = event.getChannel();
|
||||
String content = msg.getContentRaw();
|
||||
|
||||
|
||||
if (islogEnabled) { //enables / disables terminal output
|
||||
System.out.println("Message Received from " + event.getAuthor().getName() + " with the message: " + msg);
|
||||
}
|
||||
String content = msg.getContentRaw();
|
||||
System.out.println(content);
|
||||
MessageChannel channel = event.getChannel();
|
||||
|
||||
if (!event.getAuthor().getName().equals("CPEServerNotification")) {
|
||||
|
||||
//System.out.println("message content = " + content);
|
||||
//System.out.println("contains results = " + contains(content, Constants.ACTIVATOR));
|
||||
if (contains(content, Constants.ACTIVATOR) && !event.getAuthor().getName().equals("CPEServerNotification"))
|
||||
switch (content) {
|
||||
case (Constants.ACTIVATOR + "test"): {
|
||||
channel.sendMessage("Test Received!").queue();
|
||||
|
@ -74,7 +78,10 @@ public static boolean testingMode = true;
|
|||
break;
|
||||
|
||||
case (Constants.ACTIVATOR + "c"): {
|
||||
WOL.wol("192.168.1.77", "90:B1:1C:26:23:34");
|
||||
channel.sendMessage("Sending WOL message to Server").queue();
|
||||
String wolReturn = WOL.wol("192.168.1.77", "90:B1:1C:26:23:34");
|
||||
System.out.println(wolReturn);
|
||||
channel.sendMessage(wolReturn).queue();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -84,7 +91,7 @@ public static boolean testingMode = true;
|
|||
break;
|
||||
|
||||
case (Constants.ACTIVATOR + "CUMMEY"): {
|
||||
while(true){
|
||||
while (true) {
|
||||
channel.sendMessage("CUM ZONE").queue();
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +150,7 @@ public static boolean testingMode = true;
|
|||
channel.sendMessage("You are not Authorised to use sudo commands").queue();
|
||||
}
|
||||
}
|
||||
case(Constants.ACTIVATOR + "debug mode"):{
|
||||
case (Constants.ACTIVATOR + "debugMode"): {
|
||||
System.out.println(event.getChannel().getId());
|
||||
}
|
||||
default: { //broken
|
||||
|
@ -152,14 +159,14 @@ public static boolean testingMode = true;
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static String getIsTestingMode(){
|
||||
|
||||
public static String getIsTestingMode(){
|
||||
if(testingMode)
|
||||
return "TESTING MODE";
|
||||
else return (" ' " + Constants.ACTIVATOR +" ' to activate bot");
|
||||
}
|
||||
|
||||
public static String consoleIn() {
|
||||
public static String consoleIn() {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
return scanner.nextLine();
|
||||
}
|
||||
|
@ -173,4 +180,7 @@ public static String consoleIn() {
|
|||
// System.out.println("Message Received from " + event.getAuthor().getName() + " with the message: " + msg);
|
||||
//
|
||||
// }
|
||||
public static boolean contains(String str, char chr) {
|
||||
return str.indexOf(chr) != -1;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ public class WOL {
|
|||
|
||||
public static final int PORT = 9;
|
||||
|
||||
public static void wol(String ipStr, String macStr) {
|
||||
public static String wol(String ipStr, String macStr) {
|
||||
|
||||
|
||||
try {
|
||||
|
@ -27,9 +27,11 @@ public class WOL {
|
|||
socket.close();
|
||||
|
||||
System.out.println("Wake-on-LAN packet sent.");
|
||||
return "WOL Packet Sent";
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println("Failed to send Wake-on-LAN packet: + e");
|
||||
return "Failed to send Wake-on-LAN packet: + e";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue