implement ignore and add stub for unignore

This commit is contained in:
Infinidoge 2024-12-28 04:05:10 -05:00
parent 88e967eb1a
commit e9eb68285e
Signed by: Infinidoge
SSH key fingerprint: SHA256:GT2StvPQMMfFHyiiFJymQxfTG/z6EWLJ6NWItf5K5sA

View file

@ -1,8 +1,9 @@
import logging import logging
from asyncio import TaskGroup from asyncio import TaskGroup
from textwrap import indent from textwrap import indent
from typing import Union
from disnake import Embed from disnake import Embed, Member, TextChannel
from disnake.ext.commands import Cog, group, guild_only from disnake.ext.commands import Cog, group, guild_only
from .utils import can_view, confirm, fetch_exists, fetch_unpacked, test_keyword from .utils import can_view, confirm, fetch_exists, fetch_unpacked, test_keyword
@ -307,12 +308,21 @@ class Notifications(Cog):
@keyword.group(invoke_without_command=True) @keyword.group(invoke_without_command=True)
@guild_only() @guild_only()
async def ignore(self, ctx, channel): async def ignore(self, ctx, target: Union[TextChannel, Member]):
await ctx.bot.db.execute("INSERT INTO user_ignores VALUES(?, ?, ?)", (ctx.author.id, ctx.guild.id, target.id))
await ctx.bot.db.commit()
await ctx.send(f"Now ignoring {target}")
@keyword.command()
@guild_only()
async def uningnore(self, ctx, target: Union[TextChannel, Member]):
pass pass
# TODO: Ignore channels and users # TODO: Unignore
@ignore.command() @ignore.command()
@guild_only() @guild_only()
async def active(self, ctx): async def active(self, ctx):
pass await ctx.bot.user_toggle(ctx.author.id, "ignore_active")
# TODO: Ignore active channel await ctx.bot.send("Toggled ignore active channel") # TODO: Send current state
# TODO: Ignore active channel in handler