# Path: modnotes/apsw_wrapper.py
# class Connection(apsw.Connection, ContextManagerMixin):
#     pass
# 
# Path: modnotes/converters.py
# class MemberOrID(NamedTuple):
#     member: Optional[discord.Member]
#     id: int
# 
#     @classmethod
#     async def convert(cls, ctx: Context, argument: str):
# 
#         with contextlib.suppress(Exception):
#             m = await _discord_member_converter_instance.convert(ctx, argument)
#             return cls(m, m.id)
# 
#         match = _id_regex.match(argument) or _mention_regex.match(argument)
#         if match:
#             return cls(None, int(match.group(1)))
# 
#         raise BadArgument()


import asyncio
import logging
import discord
from datetime import datetime
from typing import Iterator, Literal, NamedTuple, Optional
from redbot.core import checks, commands
from redbot.core.bot import Red
from redbot.core.data_manager import cog_data_path
from redbot.core.utils import menus
from .apsw_wrapper import Connection
from .converters import MemberOrID
                """
                SELECT uid, author_id, subject_id, guild_id, note, created
                FROM member_notes
                WHERE subject_id=? AND guild_id=?
                ORDER BY created
                """,
                (member_id, guild_id),
            ):
                yield Note(*items)

    def find_by_guild(self, guild_id: int) -> Iterator[Note]:
        with self._connection.with_cursor() as cursor:
            for items in cursor.execute(
                """
                SELECT uid, author_id, subject_id, guild_id, note, created
                FROM member_notes
                WHERE guild_id=?
                ORDER BY created
                """,
                (guild_id,),
            ):
                yield Note(*items)

    def delete_by_uid(self, uid: int):
        with self._connection.with_cursor() as cursor:
            cursor.execute("DELETE FROM NOTES WHERE uid=?", (uid,))

    @checks.mod()
    @commands.guild_only()
    @commands.command()

# Path: modnotes/apsw_wrapper.py
# class Connection(apsw.Connection, ContextManagerMixin):
#     pass
# 
# Path: modnotes/converters.py
# class MemberOrID(NamedTuple):
#     member: Optional[discord.Member]
#     id: int
# 
#     @classmethod
#     async def convert(cls, ctx: Context, argument: str):
# 
#         with contextlib.suppress(Exception):
#             m = await _discord_member_converter_instance.convert(ctx, argument)
#             return cls(m, m.id)
# 
#         match = _id_regex.match(argument) or _mention_regex.match(argument)
#         if match:
#             return cls(None, int(match.group(1)))
# 
#         raise BadArgument()


# Path: modnotes/modnotes.py
import asyncio
import logging
import discord
from datetime import datetime
from typing import Iterator, Literal, NamedTuple, Optional
from redbot.core import checks, commands
from redbot.core.bot import Red
from redbot.core.data_manager import cog_data_path
from redbot.core.utils import menus
from .apsw_wrapper import Connection
from .converters import MemberOrID

                """
                SELECT uid, author_id, subject_id, guild_id, note, created
                FROM member_notes
                WHERE subject_id=? AND guild_id=?
                ORDER BY created
                """,
                (member_id, guild_id),
            ):
                yield Note(*items)

    def find_by_guild(self, guild_id: int) -> Iterator[Note]:
        with self._connection.with_cursor() as cursor:
            for items in cursor.execute(
                """
                SELECT uid, author_id, subject_id, guild_id, note, created
                FROM member_notes
                WHERE guild_id=?
                ORDER BY created
                """,
                (guild_id,),
            ):
                yield Note(*items)

    def delete_by_uid(self, uid: int):
        with self._connection.with_cursor() as cursor:
            cursor.execute("DELETE FROM NOTES WHERE uid=?", (uid,))

    @checks.mod()
    @commands.guild_only()
    @commands.command()

    async def makemodnote(self, ctx, user: MemberOrID, *, note: str):