Skip to content

Commit

Permalink
Update 3 files
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Aug 5, 2023
1 parent 4b0dd09 commit 801194f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
8 changes: 3 additions & 5 deletions tlg_bot/kreacher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
BOT_USERNAME = config.BOT_USERNAME
ASSISTANT_ID = config.ASSISTANT_ID

_bot = TelegramClient(None, api_id=config.API_ID, api_hash=config.API_HASH)
kreacher = _bot.start(bot_token=config.BOT_TOKEN)
client = TelegramClient(None, config.API_ID, config.API_HASH)
ins = GroupCallFactory(client, GroupCallFactory.MTPROTO_CLIENT_TYPE.TELETHON)
client.start()
kreacher = TelegramClient(None, api_id=config.API_ID, api_hash=config.API_HASH)
ins = GroupCallFactory(kreacher, GroupCallFactory.MTPROTO_CLIENT_TYPE.TELETHON)
kreacher.start(bot_token=config.BOT_TOKEN)
3 changes: 1 addition & 2 deletions tlg_bot/kreacher/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import logging
from termcolor import colored
from kreacher import kreacher
from kreacher import client


logging.basicConfig(
Expand All @@ -25,7 +24,7 @@

async def start_bot():
print(f'{colored("[INFO]", "blue")}: LOADING ASSISTANT DETAILS')
botme = await client.get_me()
botme = await kreacher.get_me()
botid = telethon.utils.get_peer_id(botme)
print(f'{colored("[INFO]", "blue")}: ASSISTANT ID {botid}')

Expand Down
11 changes: 5 additions & 6 deletions tlg_bot/kreacher/helpers/find_movie.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from Config import Config
from kreacher import client, kreacher
from kreacher import config, kreacher
from telethon import events
from telethon.tl.functions.messages import SearchRequest
from telethon.tl.types import InputMessagesFilterVideo
Expand All @@ -9,11 +8,11 @@
query = "ejemplo"


@kreacher.on(events.NewMessage(chats=Config().MOVIES_CHANNEL))
@kreacher.on(events.NewMessage(chats=config.MOVIES_CHANNEL))
async def find_movie(event, q):
messages = await client(
messages = await kreacher(
SearchRequest(
peer=Config().MOVIES_CHANNEL,
peer=config.MOVIES_CHANNEL,
q=q,
filter=InputMessagesFilterVideo(),
max_id=0,
Expand All @@ -30,7 +29,7 @@ async def find_movie(event, q):
video_message = messages.messages[0]

with tempfile.NamedTemporaryFile(delete=False) as temp_file:
await client.download_media(video_message.video, temp_file)
await kreacher.download_media(video_message.video, temp_file)
video_path = temp_file.name

file_name = f"{uuid.uuid4()}.mp4"
Expand Down

0 comments on commit 801194f

Please sign in to comment.