Migrated settings cog

This commit is contained in:
2022-11-12 22:43:03 +01:00
parent c80d17ca6f
commit 89c2e12489
9 changed files with 201 additions and 188 deletions
+4 -4
View File
@@ -22,20 +22,20 @@ class RedisAutoJoin(RedisContextEntity, AutoJoin):
voice_channel_id (int): [description]
text_channel_id (int): [description]
"""
if not self.ctx.guild:
if not self.ctx.guild_id:
raise Exception("This method can only be invoked inside of a guild.")
value = f"{voice_channel_id}:{text_channel_id}"
await self.redis.hset(self.key("autojoin"), self.ctx.guild.id, value)
await self.redis.hset(self.key("autojoin"), self.ctx.guild_id, value)
async def disable(self):
"""
Removes the AutoJoin configuration of a guild.
"""
if not self.ctx.guild:
if not self.ctx.guild_id:
raise Exception("This method can only be invoked inside of a guild.")
await self.redis.hdel(self.key("autojoin"), self.ctx.guild.id)
await self.redis.hdel(self.key("autojoin"), self.ctx.guild_id)
__all__ = ("GlobalRedisAutoJoin", "RedisAutoJoin")