Remove owner cog

This commit is contained in:
Zeva Rose 2022-02-21 01:48:54 -07:00
parent a0fdd94432
commit 40fa82df66

View file

@ -1,46 +0,0 @@
"""J.A.R.V.I.S. Owner Cog."""
from dis_snek import MessageContext, Scale, Snake, message_command
from dis_snek.models.discord.user import User
from dis_snek.models.snek.checks import is_owner
from dis_snek.models.snek.command import check
from jarvis import jconfig
class OwnerCog(Scale):
"""
J.A.R.V.I.S. management cog.
Used by admins to control core J.A.R.V.I.S. systems
"""
def __init__(self, bot: Snake):
self.bot = bot
# self.admins = await Config.find_one(q(key="admins"))
@message_command(name="addadmin")
@check(is_owner())
async def _add(self, ctx: MessageContext, user: User) -> None:
if user.id in self.admins.value:
await ctx.send(f"{user.mention} is already an admin.")
return
self.admins.value.append(user.id)
self.admins.save()
jconfig.reload()
await ctx.send(f"{user.mention} is now an admin. Use this power carefully.")
@message_command(name="deladmin")
@is_owner()
async def _remove(self, ctx: MessageContext, user: User) -> None:
if user.id not in self.admins.value:
await ctx.send(f"{user.mention} is not an admin.")
return
self.admins.value.remove(user.id)
self.admins.save()
jconfig.reload()
await ctx.send(f"{user.mention} is no longer an admin.")
def setup(bot: Snake) -> None:
"""Add OwnerCog to J.A.R.V.I.S."""
OwnerCog(bot)