How to use Message Create Collector ? #1076
-
Hii i have some question for this Message Create Collector This my code :
i using time for 1,5 second, but var_dump not respond anything. and if im using limit 1 the createMessageCollector will respond after im typing 2 "hello" even though i set that limit on 1 is there any answer and solutions for me ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This function is not actually utilized anywhere within the library, but I believe it was created with the intention to make it easy to look for messages within a channel that contain certain features without having to worry about the loop running for too long and blocking the thread. I've never actually seen it used before and I don't know why you would ever want to use it instead of calling ->filter directly unless you had a lot of messages in the collection you're searching through. $collection = $channels->messages->filter(function (Message $message)
{
return str_contains($message->content, 'hello'); // Adds $message to $collection if it has hello in the content
}); As for why your var_dump is not responding, it is because it is inside of ->done and is losing context. Use a monolog logger and ->then instead. |
Beta Was this translation helpful? Give feedback.
This function is not actually utilized anywhere within the library, but I believe it was created with the intention to make it easy to look for messages within a channel that contain certain features without having to worry about the loop running for too long and blocking the thread. I've never actually seen it used before and I don't know why you would ever want to use it instead of calling ->filter directly unless you had a lot of messages in the collection you're searching through.
As for why your v…