Satoshi
Satoshi

Reputation: 3

How to solo-test a telegram bot within a group as multiple users

I made a Telegram bot with python-telegram-bot library, and I want to test it in a group where it has to interact with many users at the same time. Because I cannot test it only by myself (I have only one account) I was looking for some way to control other entities in the chat as if they were users, and made them interact with my bot to check the multi-user features.

I know with Telethon I can program Telegram clients, but they just execute fixed code and I cannot make them do every thing I want them to do in a particular moment without including it in its code. So I was looking, for example, something like a command-line interface where I can control those clients, something which Telegram (and my bot) could treat as a common user and which could give me total user control over it

EDIT: I was investigating with Telethon and finally created this helper code:

@client.on(events.NewMessage(pattern=r'^tlb\.say'))
async def command_handler(event):
    command = event.text[8:]
    await client.send_message(await event.get_chat(), command)

with which I can make my Telethon client say everything I want them to say in a group by telling it with tlb.say prefix. But then I found out that the Telegram API forbids a bot seeing messages from other bots, to avoid infinite loops. What else can I do now?

Upvotes: 0

Views: 23

Answers (0)

Related Questions