WIP: Make Aurora commands hybrid commands #17
2 changed files with 21 additions and 18 deletions
|
@ -48,7 +48,7 @@ class Aurora(commands.Cog):
|
||||||
This cog stores all of its data in an SQLite database."""
|
This cog stores all of its data in an SQLite database."""
|
||||||
|
|
||||||
__author__ = ["SeaswimmerTheFsh"]
|
__author__ = ["SeaswimmerTheFsh"]
|
||||||
__version__ = "2.0.6"
|
__version__ = "2.1.6"
|
||||||
|
|
||||||
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
||||||
if requester == "discord_deleted_user":
|
if requester == "discord_deleted_user":
|
||||||
|
@ -180,10 +180,11 @@ class Aurora(commands.Cog):
|
||||||
### COMMANDS
|
### COMMANDS
|
||||||
#######################################################################################################################
|
#######################################################################################################################
|
||||||
|
|
||||||
@app_commands.command(name="note")
|
@commands.hybrid_command(name="note")
|
||||||
|
@commands.mod_or_permissions(moderate_members=True)
|
||||||
async def note(
|
async def note(
|
||||||
self,
|
self,
|
||||||
interaction: discord.Interaction,
|
ctx: commands.Context,
|
||||||
target: discord.User,
|
target: discord.User,
|
||||||
reason: str,
|
reason: str,
|
||||||
silent: bool = None,
|
silent: bool = None,
|
||||||
|
@ -198,32 +199,32 @@ class Aurora(commands.Cog):
|
||||||
Why are you noting this user?
|
Why are you noting this user?
|
||||||
silent: bool
|
silent: bool
|
||||||
Should the user be messaged?"""
|
Should the user be messaged?"""
|
||||||
if not await check_moddable(target, interaction, ["moderate_members"]):
|
if not await check_moddable(target, ctx, ["moderate_members"]):
|
||||||
return
|
return
|
||||||
|
|
||||||
await interaction.response.send_message(
|
message = await ctx.send(
|
||||||
content=f"{target.mention} has recieved a note!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has recieved a note!\n**Reason** - `{reason}`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if silent is None:
|
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:
|
if silent is False:
|
||||||
try:
|
try:
|
||||||
embed = await message_factory(
|
embed = await message_factory(
|
||||||
await self.bot.get_embed_color(interaction.channel),
|
await self.bot.get_embed_color(ctx.channel),
|
||||||
guild=interaction.guild,
|
guild=ctx.guild,
|
||||||
moderator=interaction.user,
|
moderator=ctx.author,
|
||||||
reason=reason,
|
reason=reason,
|
||||||
moderation_type="note",
|
moderation_type="note",
|
||||||
response=await interaction.original_response(),
|
response=message,
|
||||||
)
|
)
|
||||||
await target.send(embed=embed)
|
await target.send(embed=embed)
|
||||||
except discord.errors.HTTPException:
|
except discord.errors.HTTPException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
moderation_id = await mysql_log(
|
moderation_id = await mysql_log(
|
||||||
interaction.guild.id,
|
ctx.guild.id,
|
||||||
interaction.user.id,
|
ctx.author.id,
|
||||||
"NOTE",
|
"NOTE",
|
||||||
"USER",
|
"USER",
|
||||||
target.id,
|
target.id,
|
||||||
|
@ -231,13 +232,13 @@ class Aurora(commands.Cog):
|
||||||
"NULL",
|
"NULL",
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await message.edit(
|
||||||
content=f"{target.mention} has received a note! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
|
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)
|
case = await fetch_case(moderation_id, ctx.guild.id)
|
||||||
await send_evidenceformat(interaction, case)
|
await send_evidenceformat(ctx, case)
|
||||||
|
|
||||||
@app_commands.command(name="warn")
|
@app_commands.command(name="warn")
|
||||||
async def warn(
|
async def warn(
|
||||||
|
|
|
@ -3,12 +3,14 @@ from datetime import datetime, timedelta
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
import humanize
|
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 import commands
|
||||||
from redbot.core.utils.chat_formatting import bold, box, error, warning
|
from redbot.core.utils.chat_formatting import bold, box, error, warning
|
||||||
|
|
||||||
from aurora.utilities.config import config
|
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(
|
async def message_factory(
|
||||||
|
|
Loading…
Reference in a new issue