Fix permissions
This commit is contained in:
parent
284b8b6f1e
commit
dec491f003
1 changed files with 4 additions and 2 deletions
|
@ -89,9 +89,10 @@ class MSCGetter(niobot.Module):
|
||||||
return await ctx.respond(f"[{data['title']}]({data['html_url']})")
|
return await ctx.respond(f"[{data['title']}]({data['html_url']})")
|
||||||
|
|
||||||
@niobot.command("automsc.enable")
|
@niobot.command("automsc.enable")
|
||||||
@niobot.sender_has_power(50)
|
|
||||||
async def auto_msc_enable(self, ctx: niobot.Context):
|
async def auto_msc_enable(self, ctx: niobot.Context):
|
||||||
"""Automatically enables MSC linking. Requires a power level of at least 50."""
|
"""Automatically enables MSC linking. Requires a power level of at least 50."""
|
||||||
|
if (sp := ctx.room.power_levels.users.get(ctx.message.sender, -999)) < 50:
|
||||||
|
return await ctx.respond("You need to have at least a power level of 50 to use this.")
|
||||||
key = self.bot.redis_key(ctx.room.room_id, "auto_msc.enabled")
|
key = self.bot.redis_key(ctx.room.room_id, "auto_msc.enabled")
|
||||||
exists = await self.bot.redis.get(key)
|
exists = await self.bot.redis.get(key)
|
||||||
if exists:
|
if exists:
|
||||||
|
@ -103,9 +104,10 @@ class MSCGetter(niobot.Module):
|
||||||
)
|
)
|
||||||
|
|
||||||
@niobot.command("automsc.disable")
|
@niobot.command("automsc.disable")
|
||||||
@niobot.sender_has_power(50)
|
|
||||||
async def auto_msc_disable(self, ctx: niobot.Context):
|
async def auto_msc_disable(self, ctx: niobot.Context):
|
||||||
"""Disables automatic MSC linking. Requires a power level of at least 50."""
|
"""Disables automatic MSC linking. Requires a power level of at least 50."""
|
||||||
|
if (sp := ctx.room.power_levels.users.get(ctx.message.sender, -999)) < 50:
|
||||||
|
return await ctx.respond("You need to have at least a power level of 50 to use this.")
|
||||||
key = self.bot.redis_key(ctx.room.room_id, "auto_msc.enabled")
|
key = self.bot.redis_key(ctx.room.room_id, "auto_msc.enabled")
|
||||||
exists = await self.bot.redis.get(key)
|
exists = await self.bot.redis.get(key)
|
||||||
if exists:
|
if exists:
|
||||||
|
|
Loading…
Reference in a new issue