dpytest icon indicating copy to clipboard operation
dpytest copied to clipboard

sent_queue questions

Open bravosierra99 opened this issue 5 years ago • 3 comments

I've started using this module and think it's a really great idea. I was modifying the runner.verify_message function so that I can check if a message contains content (as opposed to direct matching). In the process I wanted to add the ability to run multiple verifies in a row (in my test I verify that is has something, and that it doesn't have something else). In order to do this I had to change verify_message to push the message back on to the sent_queue. However, what I'm figuring out is that right now the ONLY time I'm seeing the sent_queue pop an item off is in the verify call... so if I sent 3 commands to my bot and then ran a verify_message it would be verifying the result of my first command.

Is this the intent? Is it expected that I'm only running one verify call per command I send, and that I MUST run a verify command for each command (or call empty_queue?) I would like to have the ability to run multiple verify commands for the same message and then determine I'm ready to move to the next command. I'm not sure if this makes sense or not but I'm having trouble understanding the best way to use the verify functions.

bravosierra99 avatar Jun 01 '20 17:06 bravosierra99

so it seems to work with "putting" the message back into the queue, and then calling empty_queue() anytime I want to run a new command and begin verifying the message returned for it. If that makes sense I can create a pull request with that code.

bravosierra99 avatar Jun 01 '20 18:06 bravosierra99

It is the intent that one verify call be sent per message sent, or have empty_queue called to discard messages, but I would support allowing it to 'put back' the message. Alternatively, have it only peek the queue instead of pop it if a flag is passed

CraftSpider avatar Jun 01 '20 20:06 CraftSpider

ok, I'll submit a pull request in a minute. Going to go over the code, not sure if the way I'm doing it is the best way yet.

bravosierra99 avatar Jun 03 '20 12:06 bravosierra99

This was fixed with the "peek=True", I think. Closing

Sergeileduc avatar Dec 08 '22 08:12 Sergeileduc