我知道你不应该关注 YouTube 教程,但我做到了,现在我很后悔,因为我在这里。
我会在我的不和谐频道中说“testautomod”或“pleasework”,但什么也不会发生。过去一个小时我一直对着我的电脑尖叫
package diabot;
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
public class Automod extends ListenerAdapter {
public void onGuildMessageRecived(GuildMessageReceivedEvent event) {
String[] LIST_OF_BAD_WORDS = {"testautomod", "pleasework", "gamermomentitdoesntwork" };
String[] message = event.getMessage().getContentRaw().split(" ");
for (int i = 0; i < message.length; i++) {
for (int b = 0; b < LIST_OF_BAD_WORDS.length; b++) {
if (message[i].equalsIgnoreCase(LIST_OF_BAD_WORDS[b])) {
event.getMessage().delete().queue();
}
}
}
}
}