我正在制作一个不和谐的机器人,我想获取服务器所有者的用户名并将其放入字符串中。
我想要的 ProcessCommand 类的代码:
@SuppressWarnings("unused")
public static void proccessCommand(IMessage message, String prefix) {
IUser sender = message.getAuthor();
IChannel channel = message.getChannel();
IGuild guild = message.getGuild();
String[] command = message.getContent().toLowerCase().replaceFirst(prefix, "").split(" ");
if(command[0].equals("rules")) {
channel.sendMessage("ImConor's Discord Server Rules!" + "\r\n" + "No Racism, No Alts, No Disrespect to ANYONE, No Ban Evasion" );
}
else if(command[0].equals("restart")) {
message.delete();
channel.sendMessage("@everyone, I am restarting! Please do NOT use any ModBot commands!");
}else if(command[0].equals("ping")) {
channel.sendMessage("Pong!");
}else if(command[0].equals("start")) {
if (message.getAuthor() == *string of username here*) {
message.delete();
channel.sendMessage("@everyone, I have returned!");
}
}
}