0

I want to create multiple bots in the same python script, these bots are similar, the only difference between them is the tokens.

the first idea that comes to my mind is to create a class contains the bot script, then I create new instance of this class each time I want to create a new bot, and pass the bot token to the init function.

I'm not sure if I can create a bot inside a class using telethon, all examples that I saw are using functions and decorations. Then does telethon (MTProto) supports multiple instances running together ?

Or do I need to run them concurrently ?

code examples will be very helpful for me.

Thanks.

1 Answer 1

1

In a loop the other codes wont execute without the ending of the loop.

But ofc you can make a class and then

do multithreading

Running several threads is similar to running several different programs concurrently

Click here for more about Multithreading

I hope it was helpful.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.