Fix TextChannel -> GuildText

This commit is contained in:
Zeva Rose 2022-02-03 04:59:50 -07:00
parent c15510b74d
commit 1726f008b9

View file

@ -1,6 +1,6 @@
"""J.A.R.V.I.S. PurgeCog."""
from dis_snek import InteractionContext, Permissions, Scale, Snek
from dis_snek.models.discord.channel import TextChannel
from dis_snek.models.discord.channel import GuildText
from dis_snek.models.snek.application_commands import (
OptionTypes,
slash_command,
@ -59,10 +59,10 @@ class PurgeCog(Scale):
)
@admin_or_permissions(Permissions.MANAGE_MESSAGES)
async def _autopurge_add(
self, ctx: InteractionContext, channel: TextChannel, delay: int = 30
self, ctx: InteractionContext, channel: GuildText, delay: int = 30
) -> None:
if not isinstance(channel, TextChannel):
await ctx.send("Channel must be a TextChannel", hidden=True)
if not isinstance(channel, GuildText):
await ctx.send("Channel must be a GuildText channel", hidden=True)
return
if delay <= 0:
await ctx.send("Delay must be > 0", hidden=True)
@ -92,7 +92,7 @@ class PurgeCog(Scale):
required=True,
)
@admin_or_permissions(Permissions.MANAGE_MESSAGES)
async def _autopurge_remove(self, ctx: InteractionContext, channel: TextChannel) -> None:
async def _autopurge_remove(self, ctx: InteractionContext, channel: GuildText) -> None:
autopurge = Autopurge.objects(guild=ctx.guild.id, channel=channel.id)
if not autopurge:
await ctx.send("Autopurge does not exist.", hidden=True)
@ -119,7 +119,7 @@ class PurgeCog(Scale):
)
@admin_or_permissions(Permissions.MANAGE_MESSAGES)
async def _autopurge_update(
self, ctx: InteractionContext, channel: TextChannel, delay: int
self, ctx: InteractionContext, channel: GuildText, delay: int
) -> None:
autopurge = Autopurge.objects(guild=ctx.guild.id, channel=channel.id)
if not autopurge: