-
-
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
5060f07
commit 4c688d8
Showing
5 changed files
with
27 additions
and
25 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
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,16 +1,17 @@ | ||
from kreacher import kreacher | ||
from kreacher.helpers.voice_chats import get_voice_chat | ||
from kreacher.helpers.voice_chats import VOICE_CHATS | ||
from telethon import events | ||
|
||
|
||
@kreacher.on(events.NewMessage(pattern="[!?/]leave")) | ||
async def leave_handler(event): | ||
try: | ||
chat = await event.get_chat() | ||
proto = get_voice_chat(chat) | ||
proto = VOICE_CHATS[chat.id] | ||
if proto is None: | ||
raise Exception("Streaming is not active") | ||
await proto.leave_current_group_call() | ||
VOICE_CHATS.pop(chat.id) | ||
await event.reply("<i>Goodbye master, just call me if you need me. \n\nVoice Chat left successfully.</i>", parse_mode="HTML") | ||
except Exception as e: | ||
return await event.reply(f"<i>Oops master, something wrong has happened. \n\nError:</i> <code>{e}</code>", parse_mode="HTML") |
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,17 +1,17 @@ | ||
from kreacher import ins, kreacher | ||
from kreacher.helpers.voice_chats import get_voice_chat, start_voice_chat | ||
from kreacher.helpers.voice_chats import VOICE_CHATS | ||
from telethon import events | ||
|
||
|
||
@kreacher.on(events.NewMessage(pattern="[!?/]new")) | ||
async def new_handler(event): | ||
try: | ||
chat = await event.get_chat() | ||
proto = get_voice_chat(chat) | ||
proto = VOICE_CHATS[chat.id] | ||
if proto is not None: | ||
raise Exception("Streaming is active") | ||
start_voice_chat(chat, ins) | ||
await ins.start(chat.id) | ||
VOICE_CHATS[chat.id] = ins | ||
await event.reply("<i>Master, what do you need? \n\nVoice Chat joined successfully.</i>", parse_mode="HTML") | ||
except Exception as e: | ||
return await event.reply(f"<i>Oops master, something wrong has happened. \n\nError:</i> <code>{e}</code>", parse_mode="HTML") |
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