mirror of
https://github.com/Xtao-Labs/twitter2telegram.git
synced 2024-11-21 22:58:08 +00:00
30 lines
920 B
Python
30 lines
920 B
Python
|
import pyrogram
|
||
|
import httpx
|
||
|
|
||
|
from defs.glover import api_id, api_hash
|
||
|
from scheduler import scheduler
|
||
|
from logging import getLogger, INFO, ERROR, StreamHandler, basicConfig
|
||
|
from coloredlogs import ColoredFormatter
|
||
|
|
||
|
# Enable logging
|
||
|
logs = getLogger("T2G")
|
||
|
logging_format = "%(levelname)s [%(asctime)s] [%(name)s] %(message)s"
|
||
|
logging_handler = StreamHandler()
|
||
|
logging_handler.setFormatter(ColoredFormatter(logging_format))
|
||
|
root_logger = getLogger()
|
||
|
root_logger.setLevel(ERROR)
|
||
|
root_logger.addHandler(logging_handler)
|
||
|
basicConfig(level=INFO)
|
||
|
logs.setLevel(INFO)
|
||
|
|
||
|
if not scheduler.running:
|
||
|
scheduler.start()
|
||
|
|
||
|
bot = pyrogram.Client(
|
||
|
"bot", api_id=api_id, api_hash=api_hash, plugins=dict(root="plugins")
|
||
|
)
|
||
|
headers = {
|
||
|
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.72 Safari/537.36"
|
||
|
}
|
||
|
request = httpx.AsyncClient(timeout=60.0, headers=headers)
|