Migrate cogs/modlog/command to models

This commit is contained in:
Zeva Rose 2021-08-05 17:21:41 -06:00
parent 6286f59abe
commit 905b0ceb50

View file

@ -2,7 +2,7 @@ from discord import DMChannel
from discord.ext import commands from discord.ext import commands
from discord_slash import SlashContext from discord_slash import SlashContext
from jarvis.db.types import Setting from jarvis.db.models import Setting
from jarvis.utils import build_embed from jarvis.utils import build_embed
from jarvis.utils.field import Field from jarvis.utils.field import Field
@ -14,7 +14,9 @@ class ModlogCommandCog(commands.Cog):
@commands.Cog.listener() @commands.Cog.listener()
async def on_slash_command(self, ctx: SlashContext): async def on_slash_command(self, ctx: SlashContext):
if not isinstance(ctx.channel, DMChannel) and ctx.name not in ["pw"]: if not isinstance(ctx.channel, DMChannel) and ctx.name not in ["pw"]:
modlog = Setting.get(guild=ctx.guild.id, setting="modlog") modlog = Setting.objects(
guild=ctx.guild.id, setting="modlog"
).first()
if modlog: if modlog:
channel = ctx.guild.get_channel(modlog.value) channel = ctx.guild.get_channel(modlog.value)
fields = [ fields = [