Skip to content

Commit

Permalink
Update __init__.py and play_video.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Aug 4, 2023
1 parent a499e7b commit 32ef495
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tlg_bot/kreacher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
client = TelegramClient(None, config.API_ID, config.API_HASH)
client.start()
_call_factory_py = GroupCallFactory(client, GroupCallFactory.MTPROTO_CLIENT_TYPE.TELETHON)
call_py = _call_factory_py.get_file_group_call('input.raw')
call_py = _call_factory_py.get_group_call()
20 changes: 17 additions & 3 deletions tlg_bot/kreacher/plugins/play_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,21 @@ async def _(event):
await event.delete()


@kreacher.on(events.callbackquery.CallbackQuery(data="cls"))
@kreacher.on(events.callbackquery.CallbackQuery(data="pause_callback"))
async def _(event):
await event.delete()
await call_py.set_pause(True)


@kreacher.on(events.callbackquery.CallbackQuery(data="resume_callback"))
async def _(event):
await call_py.set_pause(False)


@kreacher.on(events.callbackquery.CallbackQuery(data="end_callback"))
async def _(event):
await call_py.stop_media()


btnn = [[Button.inline("cʟᴏꜱᴇ", data="cls")]]

ctrl = [
Expand All @@ -65,7 +77,7 @@ async def _(event):
@kreacher.on(events.NewMessage(pattern="^[?!/]play_video"))
async def play_video(event):
msg = await event.reply("🔄 <i>Processing ...</i>", parse_mode="HTML")
chat_id = event.chat.id
chat = await event.get_chat()
media = await event.get_reply_message()
if not media and not ' ' in event.message.message:
await msg.edit("❗ __Send Me An Live Stream Link / YouTube Video Link / Reply To An Video To Start Video Streaming!__")
Expand Down Expand Up @@ -102,6 +114,7 @@ async def play_video(event):

try:
await sleep(2)
await call_py.start(chat.id)
await call_py.start_video(link, with_audio=True, repeat=False)
await msg.delete()
await event.reply(
Expand All @@ -126,6 +139,7 @@ async def play_video(event):

try:
await sleep(2)
await call_py.start(chat.id)
await call_py.start_video(video, with_audio=True, repeat=False)
await msg.delete()
await event.reply(
Expand Down

0 comments on commit 32ef495

Please sign in to comment.