Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Oct 8, 2023
1 parent e71ec34 commit b370b9b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion bot/models/redis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,24 @@ def get_last_queue_position(group_id: str) -> Union[int, None]:
value = list(queue.values())[-1]
return value["position"]


def update_is_played():
def next_in_queue(group_id: str) -> Union[Tuple, None]:
values = ()
queue = r.hgetall("queues")
value = queue[group_id]
if group_id not in queue:
return None
for i in range(len(value)):
if value[i].get("is_playing"):
next = value[i + 1]
values = (
next["from_user"],
next["is_playing"],
next["position"],
next["date"],
next["file"],
next["type"],
)
return values
return None
# ------------------------------------------------------------------------

0 comments on commit b370b9b

Please sign in to comment.