I set up a robot to take screenshots of movies in Telegram
In front of hosts: I put localhost, when I run it with the command python3 - m bot and send a file to the robot, it sends me a message
file/342271090/241: No such file or directory
is sent. Where is the problem?
- Before that, I set up a git stream on a dedicated server, which I put in front of Host: localhost and in front of public_url: my domain and port, and I send the python3 -m stream that belongs to it in the command with I do not face any problem
The first code is related to the stream config file
import sys
import os
from yarl import URL
try:
port = int(os.environ.get("PORT", "8080"))
except ValueError:
port = -1
if not 1 <= port <= 65535:
print("Please make sure the PORT environment variable is an integer between 1 and 65535")
sys.exit(1)
try:
api_id = int(os.environ["TG_API_ID"])
api_hash = os.environ["TG_API_HASH"]
except (KeyError, ValueError):
print("Please set the TG_API_ID and TG_API_HASH environment variables correctly")
print("You can get your own API keys at https://my.telegram.org/apps")
sys.exit(1)
trust_headers = bool(os.environ.get("TRUST_FORWARD_HEADERS"))
host = os.environ.get("HOST", "localhost")
public_url = URL(os.environ.get("PUBLIC_URL", f"http://{host}:{port}"))
session_name = os.environ.get("TG_SESSION_NAME", "tgfilestream")
bot_token = os.environ.get("BOT_TOKEN", "tgfilestream")
log_config = os.environ.get("LOG_CONFIG")
debug = bool(os.environ.get("DEBUG"))
try:
# The per-user ongoing request limit
request_limit = int(os.environ.get("REQUEST_LIMIT", "5"))
except ValueError:
print("Please make sure the REQUEST_LIMIT environment variable is an integer")
sys.exit(1)
try:
# The per-DC connection limit
connection_limit = int(os.environ.get("CONNECTION_LIMIT", "20"))
except ValueError:
print("Please make sure the CONNECTION_LIMIT environment variable is an integer")
sys.exit(1)
The second code is related to the config bot shot screenshot file
import os
from pathlib import Path
class Config:
API_ID = int(os.environ.get('API_ID'))
API_HASH = os.environ.get('API_HASH')
BOT_TOKEN = os.environ.get('BOT_TOKEN')
SESSION_NAME = os.environ.get('SESSION_NAME')
LOG_CHANNEL = int(os.environ.get('LOG_CHANNEL'))
DATABASE_URL = os.environ.get('DATABASE_URL')
AUTH_USERS = [int(i) for i in os.environ.get('AUTH_USERS', '').split(' ')]
MAX_PROCESSES_PER_USER = int(os.environ.get('MAX_PROCESSES_PER_USER', 2))
MAX_TRIM_DURATION = int(os.environ.get('MAX_TRIM_DURATION', 600))
TRACK_CHANNEL = int(os.environ.get('TRACK_CHANNEL', False))
SLOW_SPEED_DELAY = int(os.environ.get('SLOW_SPEED_DELAY', 15))
HOST = os.environ.get('HOST', '')
SCRST_OP_FLDR = Path('screenshots/')
SMPL_OP_FLDR = Path('samples/')
THUMB_OP_FLDR = Path('thumbnails/')
COLORS = ['white', 'black', 'red', 'blue', 'green', 'yellow', 'orange', 'purple', 'brown', 'gold', 'silver', 'pink']
FONT_SIZES_NAME = ['Small', 'Medium', 'Large']
FONT_SIZES = [30, 40, 50]
What should I put in front of HOST and public_url and Auth User?
I put it this way:
host = "localhost"
public_url = "https://mydomain.com:1234"))
AUTH_USERS = ('123456789')
telethon lib