-
-
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
0c69100
commit 3950f2c
Showing
4 changed files
with
52 additions
and
12 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
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,5 +1,4 @@ | ||
QUEUE = {} | ||
GROUP_CALLS = {} | ||
active = [] | ||
|
||
|
||
|
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,32 @@ | ||
from kreacher import client | ||
from pytgcalls import GroupCallFactory | ||
VOICE_CHATS = {} | ||
|
||
|
||
async def create_voice_chat(chat_id): | ||
_factory = GroupCallFactory( | ||
client, GroupCallFactory.MTPROTO_CLIENT_TYPE.TELETHON) | ||
voice_chat = _factory.get_group_call() | ||
current = VOICE_CHATS.get(chat_id) | ||
if current is not None: | ||
raise Exception("I'am joined in the Voice Chat") | ||
else: | ||
VOICE_CHATS[chat_id] = voice_chat | ||
return True | ||
|
||
|
||
async def get_voice_chat(chat_id): | ||
voice_chat = VOICE_CHATS.get(chat_id) | ||
if voice_chat is None: | ||
raise Exception("Streaming is not started") | ||
else: | ||
return voice_chat | ||
|
||
async def stop_voice_chat(chat_id): | ||
voice_chat = VOICE_CHATS.get(chat_id) | ||
if voice_chat is None: | ||
raise Exception("Streaming is not started") | ||
else: | ||
del VOICE_CHATS[chat_id] | ||
return True | ||
|
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