Closed chrisderwahre closed 6 years ago
Use && user.toString().equals("chrisderwahre")
.
Unless you have primitives (int, float, long, boolean, etc), you compare Objects with .equals
. In this case you want to compare a user to a string, you first have to make them the same class with user.toString() and then compare them with equals.
You might get a warning that toString()
is deprecated. Ignore that, please :) It does not do anything bad and will be fixed sometime soon.
Thank you.
Hey! Im getting an error if i want to check the user, am i doing something wrong? error:
Operator '==' can not be applied to 'com.cavariux.TwitchIRC.Chat.User' java.lang.String
Full code:
if (message.contains("test") && user == "chrisderwahre") { this.sendMessage("Hey Bot Admin!", channel); }