HI! I've been working on a fix on this. I need some assistance on this. Any help would be appreciated.. Error: PHP: in_array() expects parameter 2 to be array, null given in /plugins/ChatterBot/src/RTG/ChatterBot/Main.php on line 95 Code: PHP: public function onChat(PlayerChatEvent $e) { $msg = strtolower($e->getMessage()); $p = $e->getPlayer(); $n = $p->getName(); $in = strtolower($this->cfg->get("interactions")); if(in_array($msg, $in)) { switch(mt_rand(1, 3)) { case "1": $p->sendMessage("Hey, " . $n . "!"); break; case "2": $p->sendMessage("Holla, " . $n . "!"); break; case "3": $p->sendMessage("Bonjour, " . $n . "!"); break; } } else { $this->getLogger()->warning("Error, not found!"); // DEBUG line for testing } } Config: Code: --- # Author: IG # For better usage and reply from the vote, please use the word 'bot' infront of your question or message! ( not mandatory ). # Don't worry about 'upper case' or 'lower case', this bot will read it :D interactions: - "Heya" - "hey" voting: - "Your voting question" - "How to vote?" - "Add how many as you want!" votingsite: - "Your voting site's link" - "You can have multiple links!" ... Full Code: https://github.com/RTGDaCoder/ChatterBot
Error: Code: 18.02 02:32:03 [Server] INFO Warning: in_array() expects parameter 2 to be array, null given in /plugins/ChatterBot/src/RTG/ChatterBot/Main.php on line 95 18.02 02:32:03 [Server] INFO Warning: strtolower() expects parameter 1 to be string, array given in /plugins/ChatterBot/src/RTG/ChatterBot/Main.php on line 93
I'd need the plugin to get all the messages lower case instead of upper case. It won't be doing that if i remove PHP: strtolower()
Thanks, i've fixed it! https://github.com/RTGDaCoder/ChatterBot/commit/7e50a312da1264fcc17e7f75fb140993ee537646
y=f(x) [y] != f([x]); [y] = array_map("f", [x]); because f() only converts a simple x, not an array of x Use array_map() to call f() per entry of x. PHP: $in = array_map("strtolower", $interactions); WTF. Could you please kindly shut up if you can't make any sense of what you're saying?