I'm not 100% sure but I think its: PHP: $message = strtolower($data['message']);$Symbol = "(Symbol)";if(preg_match($Symbol, $message)){ //Code for if message contains the symbol} For example if you were looking for the symbol @ then the symbol variable ($Symbol) would look like this: PHP: $Symbol = "@";
That might work but regex are slow, try: PHP: if(stripos($data["message"],$symbol) !== false){//Do this} You can set $symbol to any string.
How do you make the plugin detect what's after the symbol like I want to detect the word By with the text @by
If you only need that first occurrence you can create a substring of the original starting at the stripos and then create a substring of that going from 0 to the strpos of " ". If you need to detect all occurrences of this you could do a fancy loop or use a regex (I have one like this in my Mentions plugin).
I think you want to replace a symbol in chat? PHP: $msg = str_replace("@by","replace_word",$data["message"]);
If you just need the first one that you can use: PHP: if(strpos($data['message'],"@") !== false){$foo = substr($data['message'],strpos($data['message'],"@"));$foo = substr($foo,0,strpos($foo," "));}
If I would like to detect the word after the @ like this. @Thisismyword not me! I would want to detect Thisismyword, but not the not me!
Yes this would detect the word foo in the following messages and only foo: @foo hey [email protected] @foo @not