Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

run-py-bot

Run python code from your telegram chat!

GitHub license made-with-python Maintenance Yes

RunPythonBot

🕵️ Find on Telegram

You can find this bot on Telegram as @runPython_bot. Note: I am constantly learning new concepts and I may update the source code running behind the bot.

Here is the link to the repo which has the latest source for this bot. GitHub forks GitHub Repo stars

😍 Featured in

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

💬 Example Use

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

If you are viewing from a smartphone, click on the gif to view full screen ...

runPython_bot

⚡ Deploy

You can easily deploy this bot on Python Anywhere or your local machine by following the below steps:

Note: While pasting on your machine terminal you should use Ctrl+Shift+V but make sure to use Ctrl+V to paste in the Python Anywhere bash console from the browser.

Create a free Python Anywhere account and open a Bash Console, which has everything pre-loaded.

If you are planning to deploy on your own machine, make sure to have Python3+, pip.

The following instructions will work smoothly on Linux and Mac. If you are on Windows, you may have to make slight modifications. Google is your best friend here.

  • Clone this repository and move into this directory which has this README you are reading.
git clone https://github.com/Python-World/Python_and_the_Web.git && cd Scripts/Bots/runPython_bot
  • Now add the token in the first line of token.txt.Run cat > token.txt -> Paste the token -> Press Ctrl+D

  • Create a virtual environment and install dependencies.

    python3.8 -m venv venv && source venv/bin/activate
    python3.8 -m pip install -r requirements.txt
    
  • Activate the bot by running python3.8 start.py

  • You may now close the Python Anywhere bash console window from your browser, but the bot will continue running.

Your bot is now up and running, Enjoy ! 😊

All the logs will have the timestamp in the time-zone specified in the start.py file.

To stop the bot, press Ctrl+C. You may update the code running in your server by git fetch && git pull.

😑 Limitations

Currently, the bot is deployed on a Free Tier account of Python Anywhere.

For security and performance reasons, you cannot do the following with the bot:

  • import any package
  • run the input() function
  • run the open() function
  • Execute a piece of code which takes longer than 6 seconds to execute.

You may overcome these limitations by changing the config.py file in the bot subdirectory and running the bot on your own server.

As I am constantly learning new concepts, the latest version of this bot will not have these limitations.

🤗 The Shameless Plug

Authored by Aahnik Daw.

You may click on any of the icons below to connect with me.

twitter medium facebook linkedin dev_to stackoverflow telegram youtube