Skip to content

Commit

Permalink
Added dhcp.emote command because I was bored
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminUrquhart authored Aug 22, 2018
1 parent e6327ee commit a5765f8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/net/arptell/dhcpcord/DHCPCord.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
Expand Down Expand Up @@ -330,6 +331,16 @@ public void renewIP(User user, Guild guild, boolean debug, boolean unsafe) {
catch(Exception e) {
}
}
//TODO: hex things
public String stringToHex(String string) {
StringBuilder buf = new StringBuilder(200);
for (char ch: string.toCharArray()) {
if (buf.length() > 0)
buf.append(' ');
buf.append(String.format("%04x", (int) ch));
}
return buf.toString();
}
@Override
public void onGuildLeave(GuildLeaveEvent event) {
//File file = new File("dhcp/" + event.getGuild().getId());
Expand Down Expand Up @@ -955,6 +966,15 @@ else if(id.contains(":")) {
channel.sendMessage("There was an error processing your request: " + e).queue();
}
}
if(cmd.equals("emote")) {
if(!msg.contains(" ")) {
channel.sendMessage("Usage: dhcp.emote <emote>").queue();
return;
}
String emote = msg.split(" ")[1];
channel.sendMessage("`\\u" + stringToHex(emote).toUpperCase().replace(" ", "\\u") + "`").queue();
return;
}
if(cmd.equals("service")) {
if(!msg.contains(" ")) {
channel.sendMessage("Usage: dhcp.service <start|stop|create|delete|status> <name> [<port>]").queue();
Expand Down Expand Up @@ -994,5 +1014,9 @@ else if(id.contains(":")) {
return;
}
}
if(cmd.equals("pingry")) {
channel.sendMessage("<@190544080164487168>").queue();
return;
}
}
}

0 comments on commit a5765f8

Please sign in to comment.