Skip to content

Commit

Permalink
Create AshutoshGoswami24
Browse files Browse the repository at this point in the history
Fro Google Colabe
  • Loading branch information
AshutoshGoswami24 authored Jun 15, 2024
1 parent 0299dfb commit 045af8f
Showing 1 changed file with 128 additions and 0 deletions.
128 changes: 128 additions & 0 deletions AshutoshGoswami24
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/AshutoshGoswami24/text-leech-bot/blob/v1.0.1/text_leech_bot\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"background_save": true
},
"collapsed": true,
"id": "4LRfoqdAHKl_",
"cellView": "form"
},
"outputs": [],
"source": [
"import os\n",
"import shutil\n",
"from IPython.display import clear_output\n",
"\n",
"#@title <h1><B><font color=red>𝗧𝗘𝗫𝗧-𝗟𝗘𝗘𝗖𝗛-𝗕𝗢𝗧</B>\n",
"# @markdown <div><center><a href=\"https://github.com/AshutoshGoswami24/text-leech-bot\"><img height=\"200\" src=\"https://opengraph.githubassets.com/9s29ytrymhlrsfu1tqt1pzdxyfcsjeea/AshutoshGoswami24/text-leech-bot\"></center></div>\n",
"# @markdown <br><center><h2><strong><font color=red>𝗧𝗘𝗫𝗧-𝗟𝗘𝗘𝗖𝗛-𝗕𝗢𝗧</strong></h2></center>\n",
"\n",
"\n",
"#@markdown <font color=ORANGE> Please enter the GitHub repository URL:\n",
"GITHUB_URL = \"https://github.com/AshutoshGoswami24/text-leech-bot\" #@param {type:\"string\"}\n",
"\n",
"# Determine base directory based on environment\n",
"base_dir = './repo' # Save repo in ./repo directory relative to current directory\n",
"\n",
"# Function to clone or update the repository\n",
"def clone_or_update_repo(repo_url, base_directory):\n",
" repo_name = os.path.basename(repo_url).replace('.git', '')\n",
" project_dir = os.path.join(base_directory, repo_name)\n",
"\n",
" # Check if the repository directory exists\n",
" if os.path.exists(project_dir):\n",
" print(f\"Deleting existing repository at: {project_dir} ...\")\n",
" shutil.rmtree(project_dir)\n",
" print(\"Deleted existing repository successfully!\")\n",
"\n",
" # Clone the repository\n",
" print(f\"Cloning repository from {repo_url}...\")\n",
" clone_cmd = f\"git clone {repo_url} {project_dir}\"\n",
" os.system(clone_cmd)\n",
" print(\"Repository cloned successfully!\")\n",
"\n",
" return project_dir\n",
"\n",
"# Clone or update the repository\n",
"project_dir = clone_or_update_repo(GITHUB_URL, base_dir)\n",
"\n",
"# Navigate to the project directory\n",
"print(f\"Entering project directory: {os.path.basename(project_dir)}...\")\n",
"os.chdir(project_dir)\n",
"print(\"Entered project directory successfully!\")\n",
"\n",
"clear_output()\n",
"\n",
"#@markdown <font color=ORANGE>Please enter the requirements.txt file path:\n",
"PIP_INSTALL = \"Installer\" #@param {type:\"string\"}\n",
"\n",
"# Install required dependencies\n",
"print(\"Installing required dependencies...\")\n",
"!pip install -r {PIP_INSTALL}\n",
"print(\"All requirements installed successfully!\")\n",
"\n",
"clear_output()\n",
"\n",
"#@markdown <font color=ORANGE> Install FFMPEG?\n",
"install_ffmpeg = \"Yes\" #@param [\"Yes\", \"No\"]\n",
"if install_ffmpeg == \"Yes\":\n",
" print(\"Installing FFMPEG...\")\n",
" os.system(\"apt-get install ffmpeg -qq\") # Install ffmpeg quietly\n",
" print(\"FFMPEG installed successfully!\")\n",
"else:\n",
" print(\"Skipping FFMPEG installation.\")\n",
"\n",
"#@markdown ### <font color=ORANGE>Environment Variables\n",
"\n",
"API_ID = \"\" #@param {type:\"string\"}\n",
"os.environ['API_ID'] = API_ID\n",
"\n",
"API_HASH = \"\" #@param {type:\"string\"}\n",
"os.environ['API_HASH'] = API_HASH\n",
"\n",
"BOT_TOKEN = \"\" #@param {type:\"string\"}\n",
"os.environ['BOT_TOKEN'] = BOT_TOKEN\n",
"\n",
"clear_output()\n",
"\n",
"#@markdown <font color=ORANGE>Please enter the Profile command:\n",
"RUN_COMMAND = \"python3 modules/main.py\" #@param {type:\"string\"}\n",
"\n",
"# Run the bot\n",
"print(f\"Running command: {RUN_COMMAND} ...\")\n",
"!{RUN_COMMAND}\n",
"print(\"Execution completed!\")\n"
]
}
],
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyOKELjHJIn8S+quAi9f4RB1",
"include_colab_link": true
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

0 comments on commit 045af8f

Please sign in to comment.