improvements
This commit is contained in:
parent
6800e4872e
commit
20abea5a63
@ -1,7 +1,9 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from driver.queues import QUEUE, clear_queue, get_queue, pop_an_item
|
|
||||||
from driver.core import bot, calls
|
from driver.core import bot, calls
|
||||||
|
from driver.database.dbqueue import remove_active_chat, music_off
|
||||||
|
from driver.queues import QUEUE, clear_queue, get_queue, pop_an_item
|
||||||
|
|
||||||
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
||||||
from pytgcalls.types import Update
|
from pytgcalls.types import Update
|
||||||
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
|
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
|
||||||
@ -29,6 +31,8 @@ async def skip_current_song(chat_id):
|
|||||||
chat_queue = get_queue(chat_id)
|
chat_queue = get_queue(chat_id)
|
||||||
if len(chat_queue) == 1:
|
if len(chat_queue) == 1:
|
||||||
await calls.leave_group_call(chat_id)
|
await calls.leave_group_call(chat_id)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
|
await music_off(chat_id)
|
||||||
clear_queue(chat_id)
|
clear_queue(chat_id)
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
@ -65,6 +69,8 @@ async def skip_current_song(chat_id):
|
|||||||
return [songname, link, type]
|
return [songname, link, type]
|
||||||
except:
|
except:
|
||||||
await calls.leave_group_call(chat_id)
|
await calls.leave_group_call(chat_id)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
|
await music_off(chat_id)
|
||||||
clear_queue(chat_id)
|
clear_queue(chat_id)
|
||||||
return 2
|
return 2
|
||||||
else:
|
else:
|
||||||
@ -89,18 +95,24 @@ async def skip_item(chat_id, h):
|
|||||||
@calls.on_kicked()
|
@calls.on_kicked()
|
||||||
async def kicked_handler(_, chat_id: int):
|
async def kicked_handler(_, chat_id: int):
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
|
await music_off(chat_id)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
clear_queue(chat_id)
|
clear_queue(chat_id)
|
||||||
|
|
||||||
|
|
||||||
@calls.on_closed_voice_chat()
|
@calls.on_closed_voice_chat()
|
||||||
async def closed_voice_chat_handler(_, chat_id: int):
|
async def closed_voice_chat_handler(_, chat_id: int):
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
|
await music_off(chat_id)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
clear_queue(chat_id)
|
clear_queue(chat_id)
|
||||||
|
|
||||||
|
|
||||||
@calls.on_left()
|
@calls.on_left()
|
||||||
async def left_handler(_, chat_id: int):
|
async def left_handler(_, chat_id: int):
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
|
await music_off(chat_id)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
clear_queue(chat_id)
|
clear_queue(chat_id)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user