2024-09-26 11:07:00 +00:00
|
|
|
from bot.config import REDIS_URL
|
|
|
|
import redis.asyncio as r
|
|
|
|
|
|
|
|
# Connect to Redis
|
|
|
|
redis = r.Redis.from_url(REDIS_URL)
|
|
|
|
|
|
|
|
|
|
|
|
async def get_all_removed(uid):
|
2024-09-26 12:20:22 +00:00
|
|
|
pattern = f"removed:{uid}:*"
|
2024-09-26 11:07:00 +00:00
|
|
|
|
|
|
|
# Create a dictionary to hold the keys and values
|
|
|
|
texts = []
|
|
|
|
|
|
|
|
# Use scan_iter to find all keys matching the pattern
|
2024-09-26 14:47:20 +00:00
|
|
|
async for key in redis.scan_iter(pattern):
|
2024-09-26 11:07:00 +00:00
|
|
|
# Fetch the value for each key
|
|
|
|
value = await redis.get(key)
|
|
|
|
if value:
|
2024-09-26 15:50:13 +00:00
|
|
|
texts.append(value.encode('utf-8'))
|
2024-09-26 11:07:00 +00:00
|
|
|
|
|
|
|
return texts
|