CraftSpider / dpytest

A package that assists in writing tests for discord.py
MIT License
103 stars 24 forks source link

Squashed commit of the following: #18

Closed bravosierra99 closed 4 years ago

bravosierra99 commented 4 years ago

Change verify_message to allow peeking of messages and checking if messages contain text. Added get_message to allow the tester to more easily retrieve messages sent from the bot.

bravosierra99 commented 4 years ago

hey, wanted to check on this. I was looking at adding other functionality to your test suite (ability to add attachments to a message and stuff) Don't want to get too far if you have other plans or don't want to accept pull requests. Could you let me know what you are thinking? Thanks.

bravosierra99 commented 4 years ago

this has issues if the bot returns more than one message, basically they get out of order, still thinking about how to fix it.

CraftSpider commented 4 years ago

Apologies for the delay, I have been busy with other projects. And yeah, messages getting out of order is a problem. Not sure off the top of my head how best to fix it, if there's an asyncio implementation of other data structures, one of those might be better

bravosierra99 commented 4 years ago

so I fixed the naive way... just always pop them all and put them back in the proper order... I think this might be ok? It's definitely not ideal but it does work, and I'm trying to picture the case where you are going to get a significant amount of messages (and hence this might spiral out of control). Let me know what you think about that and I can submit a new pull request. I've also made a few other modifications in different areas. I don't know if you are looking for additions or not, and if you have a way you would like it done. Just let me know and I'll work on submitting them.