Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending no-slash commands / plain text #30

Open
DLumi opened this issue Mar 22, 2021 · 5 comments
Open

Sending no-slash commands / plain text #30

DLumi opened this issue Mar 22, 2021 · 5 comments

Comments

@DLumi
Copy link

DLumi commented Mar 22, 2021

It seems strange to me that adding slash is not an optional parameter. My bot, for example, requires some text responses from the user, and I'd like to mock them, but right now, there's no way I can do it with built-in means.

Anyway, is there a workaround for now?

@DLumi
Copy link
Author

DLumi commented Mar 22, 2021

Found a workaround. Just use Pyrogram's Client() functions to send a message.
The code should be like this:

async with controller.collect(count=1) as response:
    await client.send_message(bot_id, text='Test text')

But it's kinda counterintuitive. Just saying.

@DLumi
Copy link
Author

DLumi commented Mar 22, 2021

On an unrelated note, it'd be cool to have a method that looks for the inline button and returns the button's index. Thus I won't have to change all the tests that refer to a specific button by index.
I'm sure I'd be able to do all of this by hand, but that would be a cool quality of life change.

Copy link
Owner

JosXa commented Mar 24, 2021

@DLumi This makes me rethink whether the BotController should just have generated methods for everything a regular Client can do after all! 🤔

Copy link
Owner

JosXa commented Mar 24, 2021

@DLumi Not sure about the button by index suggestion, what's the use case? How is the index important? :)

@DLumi
Copy link
Author

DLumi commented Mar 24, 2021

@DLumi Not sure about the button by index suggestion, what's the use case? How is the index important? :)

Well, just as I told you: you can search buttons by name and get their index to call them later. Cause if the button is called directly by index, then if you, say, put another button just before the one you test (and this happens) - then the whole test would be failed because of that.
Moreover, personally, I don't see why you need to search the button and get all its data back in the first place.

Other than that, this library is the bomb. It really helps with a lot of testing that I previously had to do manually. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants