mirror of
https://github.com/Matthww/TuneBot.git
synced 2026-09-21 22:47:51 +00:00
21 lines
658 B
Python
21 lines
658 B
Python
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)
|