I'm making a bot that reads user provided text file and sets the server settings according to it. My bot can set the server name but after like 0.5 second, it's turns back to old name.
I also checked if there is any other code changing the name back but I can't find anything related to it.
List<String> lines = Files.readAllLines(settings.toPath());
String[] serverName =
{lines.get(0).substring(lines.get(0).indexOf("\"")+1, lines.get(0).lastIndexOf("\"")), lines.get(0).substring(lines.get(0).lastIndexOf("\"")+1)};
// This is getting the server name from text server-name = "server_name"
if (!lines.get(0).isEmpty()) {
int lineNumber = 0;
if (!lines.get(lineNumber).equalsIgnoreCase("null")) {
if (!lines.get(lineNumber).startsWith("//")) {
Objects.requireNonNull(event.getGuild()).getManager().setName(serverName[0]).queue();
event.getChannel().sendMessage("`` COMPLETED [] " + lines.get(lineNumber) + "``").queue();
}
else {
event.getChannel().sendMessage("`` IGNORED [] " + lines.get(lineNumber) + "``").queue();
}
}
}