Run this script directly
curl -Lks bit.ly/pipclear | pythonRun this script directly
curl -Lks bit.ly/pipclear | python| export IFS=" " | |
| str="hello world what is happening" | |
| arr=( $str ) | |
| echo first word: ${arr[0]} | |
| echo second word: ${arr[1]} | |
| echo third word: ${arr[2]} |
| # pip install python-dotenv python-telegram-bot | |
| # create a .env file with | |
| # BOT_TOKEN=... | |
| # in the same dir as of this script | |
| import logging | |
| from dotenv import load_dotenv | |
| from telegram.ext.filters import Filters | |
| from telegram import ParseMode | |
| import os |
| # AAHNIK 2021 | |
| # ditch windows, may fail there | |
| # for my personal use, i dont care to write a more detailed docs | |
| import os | |
| path = os.getcwd() | |
| path = "/home/aahnik/Downloads/Telegram Desktop/dharmic_cause_ChatExport_2021-04-30/files" |
| # MIT License | |
| # Aahnik 2021 | |
| # a script to organize the files in loconotion output | |
| # also updates html and css files | |
| # unix (linux / mac) style file paths are used in the program, | |
| # will fail inevitably if run on windows | |
| # ditch windows | |
| import logging | |
| import os |
First of all you make a bot whose multiple instances are to be run from the same server.
Suppose the bot is run by invoking main.py with the bot_name and token as command line arguments.
Syntax:
[PYTHON] [ENTRY_POINT] [bot_name] [token]
Example:
python main.py mysamplebot "173453434:42jhs894_13234jsjgasjs"
You must ensure that you have Telethon installed. Run pip install telethon to install.
[optional]
You can can create file called .env in the directory from which you are running the script.
.env
| import asyncio | |
| from settings import API_ID, API_HASH | |
| from telethon import TelegramClient | |
| from utils import _ | |
| async def get_chat_id(ref=None): | |
| async with TelegramClient('tg_session', API_ID, API_HASH) as client: | |
| if not ref: | |
| ref = input('Enter link/phone/username/id to get chat info: ') |