WIP: Refactor Aurora (3.0.0) #29
2 changed files with 46 additions and 9 deletions
|
@ -20,8 +20,7 @@ from redbot.core import app_commands, commands, data_manager
|
|||
from redbot.core.app_commands import Choice
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.commands.converter import parse_relativedelta, parse_timedelta
|
||||
from redbot.core.utils.chat_formatting import (box, error, humanize_list,
|
||||
humanize_timedelta, warning)
|
||||
from redbot.core.utils.chat_formatting import box, error, humanize_list, humanize_timedelta, warning
|
||||
|
||||
from .importers.aurora import ImportAuroraView
|
||||
from .importers.galacticbot import ImportGalacticBotView
|
||||
|
@ -33,14 +32,10 @@ from .models.change import Change
|
|||
from .models.moderation import Moderation
|
||||
from .utilities.config import config, register_config
|
||||
from .utilities.database import connect, create_guild_table
|
||||
from .utilities.factory import (addrole_embed, case_factory, changes_factory,
|
||||
evidenceformat_factory, guild_embed,
|
||||
immune_embed, message_factory, overrides_embed)
|
||||
from .utilities.factory import addrole_embed, case_factory, changes_factory, evidenceformat_factory, guild_embed, immune_embed, message_factory, overrides_embed
|
||||
from .utilities.json import dump
|
||||
from .utilities.logger import logger
|
||||
from .utilities.utils import (check_moddable, check_permissions,
|
||||
get_footer_image, log, send_evidenceformat,
|
||||
timedelta_from_relativedelta)
|
||||
from .utilities.utils import check_moddable, check_permissions, get_footer_image, log, send_evidenceformat, timedelta_from_relativedelta
|
||||
|
||||
|
||||
class Aurora(commands.Cog):
|
||||
|
@ -970,6 +965,48 @@ class Aurora(commands.Cog):
|
|||
await log(interaction, moderation.id)
|
||||
await send_evidenceformat(interaction, moderation.id)
|
||||
|
||||
@app_commands.command(name="slowmode")
|
||||
async def slowmode(
|
||||
self,
|
||||
interaction: discord.Interaction,
|
||||
interval: int,
|
||||
channel: discord.TextChannel | None = None,
|
||||
reason: str | None = None,
|
||||
):
|
||||
"""Set the slowmode of a channel.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
interval: int
|
||||
The slowmode interval in seconds
|
||||
channel: discord.TextChannel
|
||||
The channel to set the slowmode in
|
||||
reason: str
|
||||
Why are you setting the slowmode?"""
|
||||
if channel is None:
|
||||
channel = interaction.channel
|
||||
|
||||
if not await check_moddable(channel, interaction, ["manage_channels"]):
|
||||
return
|
||||
|
||||
await channel.edit(slowmode_delay=interval)
|
||||
await interaction.response.send_message(f"Slowmode in {channel.mention} has been set to {interval} seconds!\n**Reason** - `{reason}`")
|
||||
|
||||
moderation = Moderation.log(
|
||||
interaction.client,
|
||||
interaction.guild.id,
|
||||
interaction.user.id,
|
||||
"SLOWMODE",
|
||||
"CHANNEL",
|
||||
channel.id,
|
||||
None,
|
||||
None,
|
||||
reason,
|
||||
)
|
||||
await interaction.edit_original_response(content=f"Slowmode in {channel.mention} has been set to {interval} seconds! (Case `#{moderation.id:,}`)\n**Reason** - `{reason}`")
|
||||
await log(interaction, moderation.id)
|
||||
await send_evidenceformat(interaction, moderation.id)
|
||||
|
||||
@app_commands.command(name="history")
|
||||
async def history(
|
||||
self,
|
||||
|
|
|
@ -222,7 +222,7 @@ class Moderation(AuroraGuildModel):
|
|||
moderation_type: str,
|
||||
target_type: str,
|
||||
target_id: int,
|
||||
role_id: int,
|
||||
role_id: int | None = None,
|
||||
duration: timedelta | None = None,
|
||||
reason: str | None = None,
|
||||
database: sqlite3.Connection | None = None,
|
||||
|
|
Loading…
Reference in a new issue