from aioredis import Redis from typing import Sequence class AutoJoin: @staticmethod async def get_channels(redis: Redis) -> Sequence[tuple]: # return all channels channels = await redis.hgetall(name="autojoin") return {key: value.split("-") for key, value in channels.items()} @staticmethod async def update_channel(redis: Redis, guild_id, voicechannel_id, textchannel_id): await redis.hset( name="autojoin", key=guild_id, value=f"{voicechannel_id}-{textchannel_id}" ) @staticmethod async def del_channel(redis: Redis, guild_id): await redis.hdel("autojoin", guild_id)