diff --git a/aurora/aurora.py b/aurora/aurora.py index 1f946f4..465fb6a 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -48,7 +48,7 @@ class Aurora(commands.Cog): This cog stores all of its data in an SQLite database.""" __author__ = ["SeaswimmerTheFsh"] - __version__ = "2.0.6" + __version__ = "2.1.6" async def red_delete_data_for_user(self, *, requester, user_id: int): if requester == "discord_deleted_user": @@ -180,10 +180,11 @@ class Aurora(commands.Cog): ### COMMANDS ####################################################################################################################### - @app_commands.command(name="note") + @commands.hybrid_command(name="note") + @commands.mod_or_permissions(moderate_members=True) async def note( self, - interaction: discord.Interaction, + ctx: commands.Context, target: discord.User, reason: str, silent: bool = None, @@ -198,32 +199,32 @@ class Aurora(commands.Cog): Why are you noting this user? silent: bool Should the user be messaged?""" - if not await check_moddable(target, interaction, ["moderate_members"]): + if not await check_moddable(target, ctx, ["moderate_members"]): return - await interaction.response.send_message( + message = await ctx.send( content=f"{target.mention} has recieved a note!\n**Reason** - `{reason}`" ) if silent is None: - silent = not await config.guild(interaction.guild).dm_users() + silent = not await config.guild(ctx.guild).dm_users() if silent is False: try: embed = await message_factory( - await self.bot.get_embed_color(interaction.channel), - guild=interaction.guild, - moderator=interaction.user, + await self.bot.get_embed_color(ctx.channel), + guild=ctx.guild, + moderator=ctx.author, reason=reason, moderation_type="note", - response=await interaction.original_response(), + response=message, ) await target.send(embed=embed) except discord.errors.HTTPException: pass moderation_id = await mysql_log( - interaction.guild.id, - interaction.user.id, + ctx.guild.id, + ctx.author.id, "NOTE", "USER", target.id, @@ -231,13 +232,13 @@ class Aurora(commands.Cog): "NULL", reason, ) - await interaction.edit_original_response( + await message.edit( content=f"{target.mention} has received a note! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`" ) - await log(interaction, moderation_id) + await log(ctx, moderation_id) - case = await fetch_case(moderation_id, interaction.guild.id) - await send_evidenceformat(interaction, case) + case = await fetch_case(moderation_id, ctx.guild.id) + await send_evidenceformat(ctx, case) @app_commands.command(name="warn") async def warn( diff --git a/aurora/utilities/factory.py b/aurora/utilities/factory.py index 48de0ed..69d8cda 100644 --- a/aurora/utilities/factory.py +++ b/aurora/utilities/factory.py @@ -3,12 +3,14 @@ from datetime import datetime, timedelta from typing import Union import humanize -from discord import Color, Embed, Guild, Member, Role, User +from discord import Color, Embed, Guild, Member, Message, Role, User from redbot.core import commands from redbot.core.utils.chat_formatting import bold, box, error, warning from aurora.utilities.config import config -from aurora.utilities.utils import fetch_channel_dict, fetch_user_dict, get_bool_emoji, get_next_case_number, get_pagesize_str +from aurora.utilities.utils import (fetch_channel_dict, fetch_user_dict, + get_bool_emoji, get_next_case_number, + get_pagesize_str) async def message_factory(