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 bf54881 commit debe244
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions bot/models/redis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from bot import r


# ------------------------------------------------------------------------
def add_to_queue(usuario_id, url, fecha):
usuario_info = {'url': url, 'fecha': fecha}
r.hset(cola, usuario_id, usuario_info)
def add_to_queue(group_id, from_user, date):
values = {"from_user": from_user, "date": date}
hset = r.hset("queues", group_id, values)
return hset


def next_in_queue():
proximo_usuario = r.hgetall(cola).popitem()

usuario_id = proximo_usuario[0]
usuario_info = proximo_usuario[1]

print(f"Usuario ID: {usuario_id}")
print(f"URL: {usuario_info[b'url'].decode()}")
print(f"Fecha: {usuario_info[b'fecha'].decode()}")

r.hdel(cola, usuario_id)
# ------------------------------------------------------------------------
queue = r.hgetall("queues").popitem()
group_id = queue[0]
value = queue[1]
hdel = r.hdel("queues", group_id)
return hdel


# ------------------------------------------------------------------------

0 comments on commit debe244

Please sign in to comment.