-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
56 lines (46 loc) · 1.95 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Created By : s0rkin
# Created Date: Aug 20, 2023
# Links : https://github.com/s0rkin/
# version ='1.0'
# ---------------------------------------------------------------------------
import os
import datetime
from modules import gpt, pronworks, workday
from telethon.sync import TelegramClient, types
from telethon.sessions import StringSession
from dotenv import load_dotenv
#load file .env config
load_dotenv()
today = datetime.datetime.now()
print("---------------------------------------------------------------------------")
print(today)
text_from = "<code>Сгенерировано нейросетью PornWorks.ai + ChatGPT! by s0rry</code>"
#crutch to disable the delay when sending img + message
boobs = pronworks.get_boobs_file
work = workday.get_day()
get_gpt = gpt.get_text()
#TELEGRAM CLIENT
try:
client = TelegramClient(StringSession(os.environ.get("TELEGRAM_STRING_SESSION")), os.environ.get("TELEGRAM_API_ID"), os.environ.get("TELEGRAM_API_HASH"))
client.start()
except Exception as e:
print(f"Exception while starting the client - {e}")
else:
print("Client started")
#main function for send message to telegram chat
async def main():
try:
uploaded = await client.upload_file(boobs)
#client.send_message need int for group only!
#(os.getenv("TELEGRAM_USER") // (int(os.getenv("TELEGRAM_GROUP"))
ret_value = await client.send_file(int(os.getenv("TELEGRAM_GROUP")), types.InputMediaUploadedPhoto(uploaded, spoiler=True))
ret_value = await client.send_message(int(os.getenv("TELEGRAM_GROUP")), work + "\n" + "\n" + get_gpt + "\n" + "\n" + text_from, parse_mode="html")
except Exception as e:
print(f"Exception while sending the message - {e}")
else:
print(f"Message sent. Return Value {ret_value}")
with client:
client.loop.run_until_complete(main())