Q:

Having Issues With onGuildMessageReceived() When Trying to Add Reactions

I'm trying to make the bot I'm coding react on a user's message when it has specific keywords in it.  I have about 50 keywords that the bot can react to, but only if they are at the start of the message. 
The bot will react with an emote when it's at the start of the user's message but not when it's after the first word. 
I've already tried asking the discord for some help but it's pretty apparent that they don't really care to be friendly to newcomers.  I've tried changing the argument from "0" to "Message. MAX_CONTENT_LENGTH" which didn't work.  I also originally had an ArrayList that I converted into a String that didn't work, and later tried using just a normal List; with the same result.  Right now I'm stuck with an extremely unoptimized if/else statement, but I can live with it.  I just need it to work. 
import net.dv8tion.jda.core.events.message.guild. GuildMessageReceivedEvent;
import net.dv8tion.jda.core.hooks. ListenerAdapter;

public class GuildMessageReceived extends ListenerAdapter {

    public void onGuildMessageReceived(GuildMessageReceivedEvent event) {
        String[] args = event.getMessage().getContentRaw().split("\\s+");

        if (args[0].equalsIgnoreCase("zachary")) {
            event.getMessage().addReaction("").queue();
        } // if
    } // onGuildMessageReceived()
} // GuildMessageReceived

I expect the result to be a reaction on the message with the keyword located inside of it at any point, not just at the beginning.  Assume that "money" is a keyword. 
What I need:
[6:52 PM] Anon: I have money
|| Reactions: :spy:

What I get:
[6:52 PM] Anon: I have money
|| Reactions: None

A:

Your code only reacts if the first message is a keyword because you're splitting by space and then only checking the first element of the array.  Convert the array to an List and use contains().  For example:
List<String> words = Arrays.asList(event.getMessage().getContentRaw().split("\\s+"));
if (words.contains("zachary")) {
  event.getMessage().addReaction("").queue();
}

If you want to easily check for multiple keywords you can instead use Collections.disjoint().  For example:
Set<String> keywords = Set.of("foo", "bar", "baz");
List<String> words = Arrays.asList(event.getMessage().getContentRaw().split("\\s+"));

if (! Collections.disjoint(keywords, words)) {
  event.getMessage().addReaction("").queue();
}

