-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3fda6a
commit 2ab1ed8
Showing
5 changed files
with
58 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1 @@ | ||
VOICE_CHATS = {} | ||
|
||
|
||
def get_voice_chat(chat): | ||
return VOICE_CHATS.get(chat.id) | ||
|
||
|
||
def start_voice_chat(chat, instance): | ||
VOICE_CHATS[chat.id] = instance | ||
|
||
|
||
def stop_voice_chat(chat): | ||
VOICE_CHATS.pop(chat.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from kreacher.dicts.dicts import VOICE_CHATS | ||
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped | ||
from pytgcalls.types.input_stream.quality import ( | ||
HighQualityAudio, | ||
HighQualityVideo, | ||
LowQualityVideo, | ||
MediumQualityVideo, | ||
) | ||
from kreacher.helpers.queues import ( | ||
QUEUE, | ||
clear_queue, | ||
get_queue, | ||
pop_an_item, | ||
active, | ||
) | ||
|
||
|
||
async def skip_current(chat): | ||
if chat.id not in QUEUE: | ||
return 0 | ||
chat_queue = get_queue(chat.id) | ||
if len(chat_queue) == 1: | ||
await VOICE_CHATS[chat.id].leave_group_call(chat.id) | ||
clear_queue(chat.id) | ||
active.remove(chat.id) | ||
return 1 | ||
songname = chat_queue[1][0] | ||
url = chat_queue[1][1] | ||
link = chat_queue[1][2] | ||
type = chat_queue[1][3] | ||
RESOLUSI = chat_queue[1][4] | ||
if type == "Audio": | ||
await VOICE_CHATS[chat.id].change_stream( | ||
chat.id, | ||
AudioPiped( | ||
url, | ||
), | ||
) | ||
elif type == "Video": | ||
if RESOLUSI == 720: | ||
hm = HighQualityVideo() | ||
elif RESOLUSI == 480: | ||
hm = MediumQualityVideo() | ||
elif RESOLUSI == 360: | ||
hm = LowQualityVideo() | ||
await VOICE_CHATS[chat.id].change_stream( | ||
chat.id, AudioVideoPiped(url, HighQualityAudio(), hm) | ||
) | ||
pop_an_item(chat.id) | ||
return [songname, link, type] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters