DEV Community

loading...
Cover image for Start chatting with Python on Telegram

Start chatting with Python on Telegram

aahnik profile image Aahnik Daw ・2 min read

I made a bot that speaks Python. Don't believe it? Check it out on Telegram @runPython_bot.

This bot basically runs your Python code or evaluates a valid pythonic expression and returns the result.

For example, you say 'yo'*5 and the bot replies yoyoyoyoyo. Cool, isn't it?

Take a look at this gif.

gif

This bot has been built using python-telegram-bot the popular wrapper for Telegram's Bot API.

Check out the source code of this bot on GitHub. Stars ⭐ and Contributions 🔥 are most welcome.

GitHub logo aahnik / run-py-bot

A telegram bot that runs python code. Evaluate pythonic expressions on the go, right from your chat. Find on telegram @runPython_bot

run-py-bot

promoted

All Contributors

Run python code from your telegram chat!

GitHub license made-with-python Maintenance Yes telegram-chat telegram-bot badge-youtube

thumbnail

Find on Telegram 🔎

You can find this bot on Telegram as @runPython_bot.

This bot is deployed on Python Anywhere free Beginner Account. You may check whether the bot is alive or not, by clicking on the start command. If the bot responds, it is alive.

Featured in 😍

  1. Tweet by Dev Community
  2. Tweet by The Python Dev
  3. Dor Moshe's Newsletter
  4. My YouTube Video Chatting with Python

Example Use 🔀

You may use pythonic expressions to easily calculate any complex problem. Or you may test your algorithms on the go.

demo

Changelog 🔖

See the Releases tab for more info.

Develop

Read the docstrings in the code for details. You will find lots of helpful links to stack overflow and documentation.

Some useful links:

  1. How to deploy a telegram bot to Heroku
  2. Telegram Bot API Documentaion
  3. Aiogram Examples
  4. The Heroku Procfile
  5. What




I don't want to write much. Explore the bot yourself.

And definitely try to make it do some hard work by giving it some long calculations or maybe try infinite loops.

You may access Python's docs through the bot by running the help() function.

For example: try giving help(str.upper).

If you are giving an expression to the bot like 4 <= 5 please use the /e command, like /e 4 <= 5.

Don't forget to rate this bot on BotsArchive

image

Why waiting? Try out the bot.

Share the bot in your telegram groups and channels.

And if you have any questions, you may ask in the comments below, or create an issue in the GitHub repo of this project.

Discussion (2)

pic
Editor guide
Collapse
rulikkk profile image
Rustem Mustafin

Great work!

I think /e should be default mode, like repl

Collapse
aahnik profile image
Aahnik Daw Author

Would implement that soon. If you are on GitHub, contributions are welcome