This commit is contained in:
16
main.py
16
main.py
@@ -1,9 +1,23 @@
|
|||||||
|
import os
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
from telethon.sync import TelegramClient
|
||||||
import markovify
|
import markovify
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
api_id = os.getenv('API_ID')
|
||||||
|
api_hash = os.getenv('API_HASH')
|
||||||
|
entity = os.getenv('ENTITY')
|
||||||
|
|
||||||
f = open("data/data.txt", "r")
|
f = open("data/data.txt", "r")
|
||||||
text = f.read()
|
text = f.read()
|
||||||
|
|
||||||
text_model = markovify.Text(text)
|
text_model = markovify.Text(text)
|
||||||
|
message = ''
|
||||||
|
|
||||||
for i in range(5):
|
for i in range(5):
|
||||||
print(text_model.make_sentence())
|
message = message + text_model.make_sentence()
|
||||||
|
|
||||||
|
with TelegramClient('bot', api_id, api_hash) as client:
|
||||||
|
client.send_message(entity=entity, message=message)
|
||||||
|
|
||||||
Reference in New Issue
Block a user