This commit is contained in:
levina 2021-10-26 15:52:09 +07:00 committed by GitHub
parent 668fbd2a7e
commit 2cbe8c9a7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

31
driver/queues.py Normal file
View File

@ -0,0 +1,31 @@
QUEUE = {}
def add_to_queue(chat_id, songname, link, ref, type, quality):
if chat_id in QUEUE:
chat_queue = QUEUE[chat_id]
chat_queue.append([songname, link, ref, type, quality])
return int(len(chat_queue)-1)
else:
QUEUE[chat_id] = [[songname, link, ref, type, quality]]
def get_queue(chat_id):
if chat_id in QUEUE:
chat_queue = QUEUE[chat_id]
return chat_queue
else:
return 0
def pop_an_item(chat_id):
if chat_id in QUEUE:
chat_queue = QUEUE[chat_id]
chat_queue.pop(0)
return 1
else:
return 0
def clear_queue(chat_id):
if chat_id in QUEUE:
QUEUE.pop(chat_id)
return 1
else:
return 0