Compare commits
14 commits
fdbc4c0810
...
5c999735f1
Author | SHA1 | Date | |
---|---|---|---|
5c999735f1 | |||
2505dd0980 | |||
4407a99b8e | |||
df22f73d2e | |||
ab22b791d1 | |||
c0c84358ef | |||
336e01456c | |||
cc1745a9d2 | |||
eefd5ece09 | |||
0503f3b78d | |||
4f01814896 | |||
4661555aa6 | |||
3e345cc3af | |||
4844f5892c |
18 changed files with 335 additions and 554 deletions
|
@ -1,38 +0,0 @@
|
||||||
FROM ghcr.io/astral-sh/uv:0.5.30@sha256:bb74263127d6451222fe7f71b330edfb189ab1c98d7898df2401fbf4f272d9b9 AS uv
|
|
||||||
FROM python:3.11-slim@sha256:6ed5bff4d7d377e2a27d9285553b8c21cfccc4f00881de1b24c9bc8d90016e82 AS python
|
|
||||||
FROM code.forgejo.org/forgejo/runner:6.2.1@sha256:fecc96a111a15811a6887ce488e75718089f24599e613e93db8e54fe70b706e8 AS forgejo-runner
|
|
||||||
|
|
||||||
FROM mcr.microsoft.com/vscode/devcontainers/base:bookworm@sha256:6155a486f236fd5127b76af33086029d64f64cf49dd504accb6e5f949098eb7e
|
|
||||||
LABEL repository="www.coastalcommits.com/cswimr/SeaCogs"
|
|
||||||
LABEL maintainer="cswimr <seaswimmerthefsh@gmail.com>"
|
|
||||||
|
|
||||||
RUN apt-get update; \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
# Red-DiscordBot
|
|
||||||
build-essential \
|
|
||||||
git \
|
|
||||||
# PyNaCl
|
|
||||||
libsodium-dev \
|
|
||||||
# CFFI
|
|
||||||
libffi-dev \
|
|
||||||
# SSH repository support
|
|
||||||
openssh-client \
|
|
||||||
# Cog dependencies
|
|
||||||
# Audio
|
|
||||||
openjdk-17-jre-headless \
|
|
||||||
# PyLav
|
|
||||||
libaio1 \
|
|
||||||
libaio-dev \
|
|
||||||
# SeaUtils
|
|
||||||
dnsutils; \
|
|
||||||
apt-get clean; \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY --from=uv --chown=vscode: /uv /uvx /bin/
|
|
||||||
COPY --from=python --chown=vscode: /usr/local /usr/local
|
|
||||||
COPY --from=forgejo-runner --chown=vscode: /bin/forgejo-runner /bin/forgejo-runner
|
|
||||||
COPY --chown=vscode: .devcontainer/home/* /home/vscode/
|
|
||||||
|
|
||||||
RUN ln -s /usr/local/bin/python3.11 /usr/local/bin/python; \
|
|
||||||
python --version; \
|
|
||||||
python -m ensurepip
|
|
|
@ -1,52 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Red-DiscordBot: SeaCogs",
|
|
||||||
"build": {
|
|
||||||
"context": "..",
|
|
||||||
"dockerfile": "Dockerfile"
|
|
||||||
},
|
|
||||||
"features": {
|
|
||||||
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
|
|
||||||
},
|
|
||||||
"customizations": {
|
|
||||||
"vscode": {
|
|
||||||
"settings": {
|
|
||||||
"python.terminal.activateEnvInCurrentTerminal": true,
|
|
||||||
"python.terminal.activateEnvironment": true,
|
|
||||||
"terminal.integrated.defaultProfile.linux": "zsh",
|
|
||||||
"terminal.integrated.profiles.linux": {
|
|
||||||
"zsh": {
|
|
||||||
"path": "/bin/zsh"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extensions": [
|
|
||||||
"charliermarsh.ruff",
|
|
||||||
"ms-azuretools.vscode-docker",
|
|
||||||
"ms-python.python",
|
|
||||||
"tekumara.typos-vscode",
|
|
||||||
"tamasfe.even-better-toml",
|
|
||||||
"redhat.vscode-yaml",
|
|
||||||
"DavidAnson.vscode-markdownlint",
|
|
||||||
"yy0931.vscode-sqlite3-editor",
|
|
||||||
"aaron-bond.better-comments",
|
|
||||||
"donjayamanne.githistory",
|
|
||||||
"eamodio.gitlens"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"containerEnv": {
|
|
||||||
"DISPLAY": "dummy",
|
|
||||||
"PYTHONUNBUFFERED": "True",
|
|
||||||
"UV_LINK_MODE": "copy",
|
|
||||||
"UV_PYTHON_PREFERENCE": "only-system",
|
|
||||||
"UV_PYTHON_DOWNLOADS": "never",
|
|
||||||
"PROJECT_DIR": "/workspaces/SeaCogs"
|
|
||||||
},
|
|
||||||
"mounts": [
|
|
||||||
"source=seacogs-persistent-data,target=/workspaces/SeaCogs/.data,type=volume"
|
|
||||||
],
|
|
||||||
"postCreateCommand": {
|
|
||||||
"Setup Virtual Environment": "uv sync --frozen && sudo chown -R vscode:vscode /workspaces/SeaCogs/.data && uv run redbot-setup --no-prompt --instance-name=local --data-path=/workspaces/SeaCogs/.data --backend=json"
|
|
||||||
},
|
|
||||||
"remoteUser": "vscode"
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
alias runactions="forgejo-runner exec --default-actions-url=https://www.coastalcommits.com --gitea-instance=https://www.coastalcommits.com"
|
|
|
@ -9,13 +9,13 @@ jobs:
|
||||||
lint:
|
lint:
|
||||||
name: Lint Code (Ruff & Pylint)
|
name: Lint Code (Ruff & Pylint)
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container: catthehacker/ubuntu:act-latest
|
container: catthehacker/ubuntu:act-latest@sha256:70d7485966a50a639ddab37445fd27c2f0b5086ad4959ec3bba228ed394c1928
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
|
|
||||||
- name: "Setup uv"
|
- name: "Setup uv"
|
||||||
uses: https://github.com/astral-sh/setup-uv@v5
|
uses: actions/setup-uv@22695119d769bdb6f7032ad67b9bca0ef8c4a174 # v5
|
||||||
with:
|
with:
|
||||||
version: "latest"
|
version: "latest"
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
|
@ -35,7 +35,7 @@ jobs:
|
||||||
docs:
|
docs:
|
||||||
name: Build Documentation (MkDocs)
|
name: Build Documentation (MkDocs)
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container: catthehacker/ubuntu:act-latest
|
container: catthehacker/ubuntu:act-latest@sha256:70d7485966a50a639ddab37445fd27c2f0b5086ad4959ec3bba228ed394c1928
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||||
|
@ -43,7 +43,7 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: "Setup uv"
|
- name: "Setup uv"
|
||||||
uses: https://github.com/astral-sh/setup-uv@v5
|
uses: actions/setup-uv@22695119d769bdb6f7032ad67b9bca0ef8c4a174 # v5
|
||||||
with:
|
with:
|
||||||
version: "latest"
|
version: "latest"
|
||||||
enable-cache: true
|
enable-cache: true
|
||||||
|
@ -54,7 +54,7 @@ jobs:
|
||||||
run: uv sync --no-dev --group=documentation
|
run: uv sync --no-dev --group=documentation
|
||||||
|
|
||||||
- name: Set environment variables
|
- name: Set environment variables
|
||||||
uses: actions/env@v2
|
uses: actions/env@1791216cd180e6578dd1d67fb8d2852b883a5f53 # v2
|
||||||
|
|
||||||
- name: Build documentation
|
- name: Build documentation
|
||||||
run: |
|
run: |
|
||||||
|
@ -74,7 +74,7 @@ jobs:
|
||||||
echo "${YELLOW}Deploying to ${BLUE}Meli ${YELLOW}on branch ${GREEN}$CI_ACTION_REF_NAME_SLUG${YELLOW}...\n"
|
echo "${YELLOW}Deploying to ${BLUE}Meli ${YELLOW}on branch ${GREEN}$CI_ACTION_REF_NAME_SLUG${YELLOW}...\n"
|
||||||
|
|
||||||
npx -p "@getmeli/cli" meli upload ./site \
|
npx -p "@getmeli/cli" meli upload ./site \
|
||||||
--url "https://pages.coastalcommits.com" \
|
--url "https://meli.csw.im" \
|
||||||
--site "${{ vars.MELI_SITE_ID }}" \
|
--site "${{ vars.MELI_SITE_ID }}" \
|
||||||
--token "${{ secrets.MELI_TOKEN }}" \
|
--token "${{ secrets.MELI_TOKEN }}" \
|
||||||
--release "$CI_ACTION_REF_NAME_SLUG/${{ env.GITHUB_SHA }}" \
|
--release "$CI_ACTION_REF_NAME_SLUG/${{ env.GITHUB_SHA }}" \
|
||||||
|
|
337
aurora/aurora.py
337
aurora/aurora.py
|
@ -40,7 +40,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__ = ["cswimr"]
|
__author__ = ["cswimr"]
|
||||||
__version__ = "2.1.3"
|
__version__ = "2.1.5"
|
||||||
__documentation__ = "https://seacogs.coastalcommits.com/aurora/"
|
__documentation__ = "https://seacogs.coastalcommits.com/aurora/"
|
||||||
|
|
||||||
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
async def red_delete_data_for_user(self, *, requester, user_id: int):
|
||||||
|
@ -70,7 +70,8 @@ class Aurora(commands.Cog):
|
||||||
await config.user_from_id(user_id).clear()
|
await config.user_from_id(user_id).clear()
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Invalid requester passed to red_delete_data_for_user: %s", requester
|
"Invalid requester passed to red_delete_data_for_user: %s",
|
||||||
|
requester,
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, bot: Red):
|
def __init__(self, bot: Red):
|
||||||
|
@ -135,9 +136,8 @@ class Aurora(commands.Cog):
|
||||||
if await config.guild(entry.guild).ignore_other_bots() is True:
|
if await config.guild(entry.guild).ignore_other_bots() is True:
|
||||||
if entry.user.bot or entry.target.bot:
|
if entry.user.bot or entry.target.bot:
|
||||||
return
|
return
|
||||||
else:
|
elif entry.user.id == self.bot.user.id:
|
||||||
if entry.user.id == self.bot.user.id:
|
return
|
||||||
return
|
|
||||||
|
|
||||||
duration = "NULL"
|
duration = "NULL"
|
||||||
|
|
||||||
|
@ -159,10 +159,10 @@ class Aurora(commands.Cog):
|
||||||
elif entry.action == discord.AuditLogAction.member_update:
|
elif entry.action == discord.AuditLogAction.member_update:
|
||||||
if entry.after.timed_out_until is not None:
|
if entry.after.timed_out_until is not None:
|
||||||
timed_out_until_aware = entry.after.timed_out_until.replace(
|
timed_out_until_aware = entry.after.timed_out_until.replace(
|
||||||
tzinfo=timezone.utc
|
tzinfo=timezone.utc,
|
||||||
)
|
)
|
||||||
duration_datetime = timed_out_until_aware - datetime.now(
|
duration_datetime = timed_out_until_aware - datetime.now(
|
||||||
tz=timezone.utc
|
tz=timezone.utc,
|
||||||
)
|
)
|
||||||
minutes = round(duration_datetime.total_seconds() / 60)
|
minutes = round(duration_datetime.total_seconds() / 60)
|
||||||
duration = timedelta(minutes=minutes)
|
duration = timedelta(minutes=minutes)
|
||||||
|
@ -209,7 +209,7 @@ class Aurora(commands.Cog):
|
||||||
return
|
return
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
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:
|
||||||
|
@ -239,7 +239,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
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(interaction, moderation_id)
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ class Aurora(commands.Cog):
|
||||||
return
|
return
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been warned!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been warned!\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
|
|
||||||
if silent is None:
|
if silent is None:
|
||||||
|
@ -298,7 +298,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=f"{target.mention} has been warned! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been warned! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
await log(interaction, moderation_id)
|
await log(interaction, moderation_id)
|
||||||
|
|
||||||
|
@ -342,7 +342,8 @@ class Aurora(commands.Cog):
|
||||||
parsed_time = parse_timedelta(duration)
|
parsed_time = parse_timedelta(duration)
|
||||||
if parsed_time is None:
|
if parsed_time is None:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error("Please provide a valid duration!"), ephemeral=True
|
content=error("Please provide a valid duration!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -350,12 +351,15 @@ class Aurora(commands.Cog):
|
||||||
|
|
||||||
if role.id not in addrole_whitelist:
|
if role.id not in addrole_whitelist:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error("That role isn't whitelisted!"), ephemeral=True
|
content=error("That role isn't whitelisted!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not await check_moddable(
|
if not await check_moddable(
|
||||||
target, interaction, ["moderate_members", "manage_roles"]
|
target,
|
||||||
|
interaction,
|
||||||
|
["moderate_members", "manage_roles"],
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -390,7 +394,7 @@ class Aurora(commands.Cog):
|
||||||
reason=f"Role added by {interaction.user.id}{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''} for: {reason}",
|
reason=f"Role added by {interaction.user.id}{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''} for: {reason}",
|
||||||
)
|
)
|
||||||
response: discord.WebhookMessage = await interaction.followup.send(
|
response: discord.WebhookMessage = await interaction.followup.send(
|
||||||
content=f"{target.mention} has been given the {role.mention} role{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''}!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been given the {role.mention} role{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''}!\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
|
|
||||||
moderation_id = await mysql_log(
|
moderation_id = await mysql_log(
|
||||||
|
@ -448,7 +452,8 @@ class Aurora(commands.Cog):
|
||||||
parsed_time = parse_timedelta(duration)
|
parsed_time = parse_timedelta(duration)
|
||||||
if parsed_time is None:
|
if parsed_time is None:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error("Please provide a valid duration!"), ephemeral=True
|
content=error("Please provide a valid duration!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -456,12 +461,15 @@ class Aurora(commands.Cog):
|
||||||
|
|
||||||
if role.id not in addrole_whitelist:
|
if role.id not in addrole_whitelist:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error("That role isn't whitelisted!"), ephemeral=True
|
content=error("That role isn't whitelisted!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not await check_moddable(
|
if not await check_moddable(
|
||||||
target, interaction, ["moderate_members", "manage_roles"]
|
target,
|
||||||
|
interaction,
|
||||||
|
["moderate_members", "manage_roles"],
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -496,7 +504,7 @@ class Aurora(commands.Cog):
|
||||||
reason=f"Role removed by {interaction.user.id}{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''} for: {reason}",
|
reason=f"Role removed by {interaction.user.id}{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''} for: {reason}",
|
||||||
)
|
)
|
||||||
response: discord.WebhookMessage = await interaction.followup.send(
|
response: discord.WebhookMessage = await interaction.followup.send(
|
||||||
content=f"{target.mention} has had the {role.mention} role removed{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''}!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has had the {role.mention} role removed{' for ' + humanize_timedelta(timedelta=parsed_time) if parsed_time != 'NULL' else ''}!\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
|
|
||||||
moderation_id = await mysql_log(
|
moderation_id = await mysql_log(
|
||||||
|
@ -553,21 +561,24 @@ class Aurora(commands.Cog):
|
||||||
parsed_time = parse_timedelta(duration, maximum=timedelta(days=28))
|
parsed_time = parse_timedelta(duration, maximum=timedelta(days=28))
|
||||||
if parsed_time is None:
|
if parsed_time is None:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
error("Please provide a valid duration!"), ephemeral=True
|
error("Please provide a valid duration!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
except commands.BadArgument:
|
except commands.BadArgument:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
error("Please provide a duration that is less than 28 days."), ephemeral=True
|
error("Please provide a duration that is less than 28 days."),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
await target.timeout(
|
await target.timeout(
|
||||||
parsed_time, reason=f"Muted by {interaction.user.id} for: {reason}"
|
parsed_time,
|
||||||
|
reason=f"Muted by {interaction.user.id} for: {reason}",
|
||||||
)
|
)
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been muted for {humanize_timedelta(timedelta=parsed_time)}!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been muted for {humanize_timedelta(timedelta=parsed_time)}!\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
|
|
||||||
if silent is None:
|
if silent is None:
|
||||||
|
@ -598,7 +609,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=f"{target.mention} has been muted for {humanize_timedelta(timedelta=parsed_time)}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been muted for {humanize_timedelta(timedelta=parsed_time)}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
await log(interaction, moderation_id)
|
await log(interaction, moderation_id)
|
||||||
|
|
||||||
|
@ -636,14 +647,15 @@ class Aurora(commands.Cog):
|
||||||
|
|
||||||
if reason:
|
if reason:
|
||||||
await target.timeout(
|
await target.timeout(
|
||||||
None, reason=f"Unmuted by {interaction.user.id} for: {reason}"
|
None,
|
||||||
|
reason=f"Unmuted by {interaction.user.id} for: {reason}",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await target.timeout(None, reason=f"Unbanned by {interaction.user.id}")
|
await target.timeout(None, reason=f"Unbanned by {interaction.user.id}")
|
||||||
reason = "No reason given."
|
reason = "No reason given."
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been unmuted!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been unmuted!\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
|
|
||||||
if silent is None:
|
if silent is None:
|
||||||
|
@ -673,7 +685,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=f"{target.mention} has been unmuted! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been unmuted! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
await log(interaction, moderation_id)
|
await log(interaction, moderation_id)
|
||||||
|
|
||||||
|
@ -702,7 +714,7 @@ class Aurora(commands.Cog):
|
||||||
return
|
return
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been kicked!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been kicked!\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
|
|
||||||
if silent is None:
|
if silent is None:
|
||||||
|
@ -734,7 +746,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=f"{target.mention} has been kicked! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been kicked! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
await log(interaction, moderation_id)
|
await log(interaction, moderation_id)
|
||||||
|
|
||||||
|
@ -750,7 +762,7 @@ class Aurora(commands.Cog):
|
||||||
Choice(name="1 Day", value=86400),
|
Choice(name="1 Day", value=86400),
|
||||||
Choice(name="3 Days", value=259200),
|
Choice(name="3 Days", value=259200),
|
||||||
Choice(name="7 Days", value=604800),
|
Choice(name="7 Days", value=604800),
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
async def ban(
|
async def ban(
|
||||||
self,
|
self,
|
||||||
|
@ -786,7 +798,8 @@ class Aurora(commands.Cog):
|
||||||
try:
|
try:
|
||||||
await interaction.guild.fetch_ban(target)
|
await interaction.guild.fetch_ban(target)
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error(f"{target.mention} is already banned!"), ephemeral=True
|
content=error(f"{target.mention} is already banned!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
except discord.errors.NotFound:
|
except discord.errors.NotFound:
|
||||||
|
@ -796,19 +809,21 @@ class Aurora(commands.Cog):
|
||||||
parsed_time = parse_relativedelta(duration)
|
parsed_time = parse_relativedelta(duration)
|
||||||
if parsed_time is None:
|
if parsed_time is None:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error("Please provide a valid duration!"), ephemeral=True
|
content=error("Please provide a valid duration!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
parsed_time = timedelta_from_relativedelta(parsed_time)
|
parsed_time = timedelta_from_relativedelta(parsed_time)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error("Please provide a valid duration!"), ephemeral=True
|
content=error("Please provide a valid duration!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been banned for {humanize_timedelta(timedelta=parsed_time)}!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been banned for {humanize_timedelta(timedelta=parsed_time)}!\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -842,7 +857,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=f"{target.mention} has been banned for {humanize_timedelta(timedelta=parsed_time)}! (Case `#{moderation_id}`)\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been banned for {humanize_timedelta(timedelta=parsed_time)}! (Case `#{moderation_id}`)\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
await log(interaction, moderation_id)
|
await log(interaction, moderation_id)
|
||||||
|
|
||||||
|
@ -850,14 +865,14 @@ class Aurora(commands.Cog):
|
||||||
await send_evidenceformat(interaction, case)
|
await send_evidenceformat(interaction, case)
|
||||||
else:
|
else:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been banned!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been banned!\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(interaction.guild).dm_users()
|
||||||
if silent is False:
|
if silent is False:
|
||||||
try:
|
try:
|
||||||
embed = embed = await message_factory(
|
embed = await message_factory(
|
||||||
await self.bot.get_embed_color(interaction.channel),
|
await self.bot.get_embed_color(interaction.channel),
|
||||||
guild=interaction.guild,
|
guild=interaction.guild,
|
||||||
moderator=interaction.user,
|
moderator=interaction.user,
|
||||||
|
@ -886,7 +901,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=f"{target.mention} has been banned! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been banned! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
await log(interaction, moderation_id)
|
await log(interaction, moderation_id)
|
||||||
|
|
||||||
|
@ -918,22 +933,25 @@ class Aurora(commands.Cog):
|
||||||
await interaction.guild.fetch_ban(target)
|
await interaction.guild.fetch_ban(target)
|
||||||
except discord.errors.NotFound:
|
except discord.errors.NotFound:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error(f"{target.mention} is not banned!"), ephemeral=True
|
content=error(f"{target.mention} is not banned!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
if reason:
|
if reason:
|
||||||
await interaction.guild.unban(
|
await interaction.guild.unban(
|
||||||
target, reason=f"Unbanned by {interaction.user.id} for: {reason}"
|
target,
|
||||||
|
reason=f"Unbanned by {interaction.user.id} for: {reason}",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await interaction.guild.unban(
|
await interaction.guild.unban(
|
||||||
target, reason=f"Unbanned by {interaction.user.id}"
|
target,
|
||||||
|
reason=f"Unbanned by {interaction.user.id}",
|
||||||
)
|
)
|
||||||
reason = "No reason given."
|
reason = "No reason given."
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been unbanned!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been unbanned!\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
|
|
||||||
if silent is None:
|
if silent is None:
|
||||||
|
@ -963,7 +981,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=f"{target.mention} has been unbanned! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been unbanned! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
await log(interaction, moderation_id)
|
await log(interaction, moderation_id)
|
||||||
|
|
||||||
|
@ -1001,42 +1019,28 @@ class Aurora(commands.Cog):
|
||||||
export: bool
|
export: bool
|
||||||
Exports the server's entire moderation history to a JSON file"""
|
Exports the server's entire moderation history to a JSON file"""
|
||||||
if ephemeral is None:
|
if ephemeral is None:
|
||||||
ephemeral = (
|
ephemeral = await config.user(interaction.user).history_ephemeral() or await config.guild(interaction.guild).history_ephemeral() or False
|
||||||
await config.user(interaction.user).history_ephemeral()
|
|
||||||
or await config.guild(interaction.guild).history_ephemeral()
|
|
||||||
or False
|
|
||||||
)
|
|
||||||
|
|
||||||
if inline is None:
|
if inline is None:
|
||||||
inline = (
|
inline = await config.user(interaction.user).history_inline() or await config.guild(interaction.guild).history_inline() or False
|
||||||
await config.user(interaction.user).history_inline()
|
|
||||||
or await config.guild(interaction.guild).history_inline()
|
|
||||||
or False
|
|
||||||
)
|
|
||||||
|
|
||||||
if pagesize is None:
|
if pagesize is None:
|
||||||
if inline is True:
|
if inline is True:
|
||||||
pagesize = (
|
pagesize = await config.user(interaction.user).history_inline_pagesize() or await config.guild(interaction.guild).history_inline_pagesize() or 6
|
||||||
await config.user(interaction.user).history_inline_pagesize()
|
|
||||||
or await config.guild(interaction.guild).history_inline_pagesize()
|
|
||||||
or 6
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
pagesize = (
|
pagesize = await config.user(interaction.user).history_pagesize() or await config.guild(interaction.guild).history_pagesize() or 5
|
||||||
await config.user(interaction.user).history_pagesize()
|
|
||||||
or await config.guild(interaction.guild).history_pagesize()
|
|
||||||
or 5
|
|
||||||
)
|
|
||||||
|
|
||||||
await interaction.response.defer(ephemeral=ephemeral)
|
await interaction.response.defer(ephemeral=ephemeral)
|
||||||
|
|
||||||
permissions = check_permissions(
|
permissions = check_permissions(
|
||||||
interaction.client.user, ["embed_links"], interaction
|
interaction.client.user,
|
||||||
|
["embed_links"],
|
||||||
|
interaction,
|
||||||
)
|
)
|
||||||
if permissions:
|
if permissions:
|
||||||
await interaction.followup.send(
|
await interaction.followup.send(
|
||||||
error(
|
error(
|
||||||
f"I do not have the `{permissions}` permission, required for this action."
|
f"I do not have the `{permissions}` permission, required for this action.",
|
||||||
),
|
),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
|
@ -1061,18 +1065,15 @@ class Aurora(commands.Cog):
|
||||||
cases.append(case)
|
cases.append(case)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filename = (
|
filename = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + f"moderation_{interaction.guild.id}.json"
|
||||||
str(data_manager.cog_data_path(cog_instance=self))
|
|
||||||
+ str(os.sep)
|
|
||||||
+ f"moderation_{interaction.guild.id}.json"
|
|
||||||
)
|
|
||||||
|
|
||||||
with open(filename, "w", encoding="utf-8") as f:
|
with open(filename, "w", encoding="utf-8") as f:
|
||||||
json.dump(cases, f, indent=2)
|
json.dump(cases, f, indent=2)
|
||||||
|
|
||||||
await interaction.followup.send(
|
await interaction.followup.send(
|
||||||
file=discord.File(
|
file=discord.File(
|
||||||
filename, f"moderation_{interaction.guild.id}.json"
|
filename,
|
||||||
|
f"moderation_{interaction.guild.id}.json",
|
||||||
),
|
),
|
||||||
ephemeral=ephemeral,
|
ephemeral=ephemeral,
|
||||||
)
|
)
|
||||||
|
@ -1081,7 +1082,7 @@ class Aurora(commands.Cog):
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
await interaction.followup.send(
|
await interaction.followup.send(
|
||||||
content=error(
|
content=error(
|
||||||
"An error occured while exporting the moderation history.\nError:\n"
|
"An error occured while exporting the moderation history.\nError:\n",
|
||||||
)
|
)
|
||||||
+ box(e, "py"),
|
+ box(e, "py"),
|
||||||
ephemeral=ephemeral,
|
ephemeral=ephemeral,
|
||||||
|
@ -1127,7 +1128,7 @@ class Aurora(commands.Cog):
|
||||||
embed = discord.Embed(color=await self.bot.get_embed_color(interaction.channel))
|
embed = discord.Embed(color=await self.bot.get_embed_color(interaction.channel))
|
||||||
embed.set_author(icon_url=interaction.guild.icon.url, name="Infraction History")
|
embed.set_author(icon_url=interaction.guild.icon.url, name="Infraction History")
|
||||||
embed.set_footer(
|
embed.set_footer(
|
||||||
text=f"Page {page:,}/{page_quantity:,} | {case_quantity:,} Results"
|
text=f"Page {page:,}/{page_quantity:,} | {case_quantity:,} Results",
|
||||||
)
|
)
|
||||||
|
|
||||||
memory_dict = {}
|
memory_dict = {}
|
||||||
|
@ -1136,33 +1137,30 @@ class Aurora(commands.Cog):
|
||||||
if case["target_id"] not in memory_dict:
|
if case["target_id"] not in memory_dict:
|
||||||
if case["target_type"] == "USER":
|
if case["target_type"] == "USER":
|
||||||
memory_dict[str(case["target_id"])] = await fetch_user_dict(
|
memory_dict[str(case["target_id"])] = await fetch_user_dict(
|
||||||
interaction.client, case["target_id"]
|
interaction.client,
|
||||||
|
case["target_id"],
|
||||||
)
|
)
|
||||||
elif case["target_type"] == "CHANNEL":
|
elif case["target_type"] == "CHANNEL":
|
||||||
memory_dict[str(case["target_id"])] = await fetch_channel_dict(
|
memory_dict[str(case["target_id"])] = await fetch_channel_dict(
|
||||||
interaction.guild, case["target_id"]
|
interaction.guild,
|
||||||
|
case["target_id"],
|
||||||
)
|
)
|
||||||
target_user = memory_dict[str(case["target_id"])]
|
target_user = memory_dict[str(case["target_id"])]
|
||||||
|
|
||||||
if case["target_type"] == "USER":
|
if case["target_type"] == "USER":
|
||||||
target_name = (
|
target_name = f"`{target_user['name']}`" if target_user["discriminator"] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
|
||||||
f"`{target_user['name']}`"
|
|
||||||
if target_user["discriminator"] == "0"
|
|
||||||
else f"`{target_user['name']}#{target_user['discriminator']}`"
|
|
||||||
)
|
|
||||||
elif case["target_type"] == "CHANNEL":
|
elif case["target_type"] == "CHANNEL":
|
||||||
target_name = f"`{target_user['mention']}`"
|
target_name = f"`{target_user['mention']}`"
|
||||||
|
else:
|
||||||
|
target_name = ""
|
||||||
|
|
||||||
if case["moderator_id"] not in memory_dict:
|
if case["moderator_id"] not in memory_dict:
|
||||||
memory_dict[str(case["moderator_id"])] = await fetch_user_dict(
|
memory_dict[str(case["moderator_id"])] = await fetch_user_dict(
|
||||||
interaction.client, case["moderator_id"]
|
interaction.client,
|
||||||
|
case["moderator_id"],
|
||||||
)
|
)
|
||||||
moderator_user = memory_dict[str(case["moderator_id"])]
|
moderator_user = memory_dict[str(case["moderator_id"])]
|
||||||
moderator_name = (
|
moderator_name = f"`{moderator_user['name']}`" if moderator_user["discriminator"] == "0" else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
|
||||||
f"`{moderator_user['name']}`"
|
|
||||||
if moderator_user["discriminator"] == "0"
|
|
||||||
else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
|
|
||||||
)
|
|
||||||
|
|
||||||
field_name = f"Case #{case['moderation_id']:,} ({str.title(case['moderation_type'])})"
|
field_name = f"Case #{case['moderation_id']:,} ({str.title(case['moderation_type'])})"
|
||||||
field_value = f"**Target:** {target_name} ({target_user['id']})\n**Moderator:** {moderator_name} ({moderator_user['id']})"
|
field_value = f"**Target:** {target_name} ({target_user['id']})\n**Moderator:** {moderator_name} ({moderator_user['id']})"
|
||||||
|
@ -1177,20 +1175,15 @@ class Aurora(commands.Cog):
|
||||||
**{
|
**{
|
||||||
unit: int(val)
|
unit: int(val)
|
||||||
for unit, val in zip(
|
for unit, val in zip(
|
||||||
["hours", "minutes", "seconds"], case["duration"].split(":")
|
["hours", "minutes", "seconds"],
|
||||||
|
case["duration"].split(":"),
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
|
||||||
duration_embed = (
|
|
||||||
f"{humanize_timedelta(timedelta=td)} | <t:{case['end_timestamp']}:R>"
|
|
||||||
if bool(case["expired"]) is False
|
|
||||||
else f"{humanize_timedelta(timedelta=td)} | Expired"
|
|
||||||
)
|
)
|
||||||
|
duration_embed = f"{humanize_timedelta(timedelta=td)} | <t:{case['end_timestamp']}:R>" if bool(case["expired"]) is False else f"{humanize_timedelta(timedelta=td)} | Expired"
|
||||||
field_value += f"\n**Duration:** {duration_embed}"
|
field_value += f"\n**Duration:** {duration_embed}"
|
||||||
|
|
||||||
field_value += (
|
field_value += f"\n**Timestamp:** <t:{case['timestamp']}> | <t:{case['timestamp']}:R>"
|
||||||
f"\n**Timestamp:** <t:{case['timestamp']}> | <t:{case['timestamp']}:R>"
|
|
||||||
)
|
|
||||||
|
|
||||||
if case["role_id"] != "0":
|
if case["role_id"] != "0":
|
||||||
role = interaction.guild.get_role(int(case["role_id"]))
|
role = interaction.guild.get_role(int(case["role_id"]))
|
||||||
|
@ -1208,7 +1201,10 @@ class Aurora(commands.Cog):
|
||||||
|
|
||||||
@app_commands.command(name="resolve")
|
@app_commands.command(name="resolve")
|
||||||
async def resolve(
|
async def resolve(
|
||||||
self, interaction: discord.Interaction, case: int, reason: str = None
|
self,
|
||||||
|
interaction: discord.Interaction,
|
||||||
|
case: int,
|
||||||
|
reason: str = None,
|
||||||
):
|
):
|
||||||
"""Resolve a specific case.
|
"""Resolve a specific case.
|
||||||
|
|
||||||
|
@ -1226,7 +1222,7 @@ class Aurora(commands.Cog):
|
||||||
if permissions:
|
if permissions:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
error(
|
error(
|
||||||
f"I do not have the `{permissions}` permission, required for this action."
|
f"I do not have the `{permissions}` permission, required for this action.",
|
||||||
),
|
),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
|
@ -1235,9 +1231,7 @@ class Aurora(commands.Cog):
|
||||||
database = connect()
|
database = connect()
|
||||||
cursor = database.cursor()
|
cursor = database.cursor()
|
||||||
|
|
||||||
query_1 = (
|
query_1 = f"SELECT * FROM moderation_{interaction.guild.id} WHERE moderation_id = ?;"
|
||||||
f"SELECT * FROM moderation_{interaction.guild.id} WHERE moderation_id = ?;"
|
|
||||||
)
|
|
||||||
cursor.execute(query_1, (case,))
|
cursor.execute(query_1, (case,))
|
||||||
result_1 = cursor.fetchone()
|
result_1 = cursor.fetchone()
|
||||||
if result_1 is None or case == 0:
|
if result_1 is None or case == 0:
|
||||||
|
@ -1253,7 +1247,7 @@ class Aurora(commands.Cog):
|
||||||
if result_2 is None:
|
if result_2 is None:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error(
|
content=error(
|
||||||
f"This moderation has already been resolved!\nUse `/case {case}` for more information."
|
f"This moderation has already been resolved!\nUse `/case {case}` for more information.",
|
||||||
),
|
),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
|
@ -1267,7 +1261,7 @@ class Aurora(commands.Cog):
|
||||||
if len(changes) > 25:
|
if len(changes) > 25:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error(
|
content=error(
|
||||||
"Due to limitations with Discord's embed system, you cannot edit a case more than 25 times."
|
"Due to limitations with Discord's embed system, you cannot edit a case more than 25 times.",
|
||||||
),
|
),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
|
@ -1279,7 +1273,7 @@ class Aurora(commands.Cog):
|
||||||
"timestamp": case_dict["timestamp"],
|
"timestamp": case_dict["timestamp"],
|
||||||
"reason": case_dict["reason"],
|
"reason": case_dict["reason"],
|
||||||
"user_id": case_dict["moderator_id"],
|
"user_id": case_dict["moderator_id"],
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
changes.append(
|
changes.append(
|
||||||
{
|
{
|
||||||
|
@ -1287,7 +1281,7 @@ class Aurora(commands.Cog):
|
||||||
"timestamp": int(time.time()),
|
"timestamp": int(time.time()),
|
||||||
"reason": reason,
|
"reason": reason,
|
||||||
"user_id": interaction.user.id,
|
"user_id": interaction.user.id,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
if case_dict["moderation_type"] in ["UNMUTE", "UNBAN"]:
|
if case_dict["moderation_type"] in ["UNMUTE", "UNBAN"]:
|
||||||
|
@ -1301,11 +1295,12 @@ class Aurora(commands.Cog):
|
||||||
if case_dict["moderation_type"] == "MUTE":
|
if case_dict["moderation_type"] == "MUTE":
|
||||||
try:
|
try:
|
||||||
member = await interaction.guild.fetch_member(
|
member = await interaction.guild.fetch_member(
|
||||||
case_dict["target_id"]
|
case_dict["target_id"],
|
||||||
)
|
)
|
||||||
|
|
||||||
await member.timeout(
|
await member.timeout(
|
||||||
None, reason=f"Case #{case:,} resolved by {interaction.user.id}"
|
None,
|
||||||
|
reason=f"Case #{case:,} resolved by {interaction.user.id}",
|
||||||
)
|
)
|
||||||
except discord.NotFound:
|
except discord.NotFound:
|
||||||
pass
|
pass
|
||||||
|
@ -1315,7 +1310,8 @@ class Aurora(commands.Cog):
|
||||||
user = await interaction.client.fetch_user(case_dict["target_id"])
|
user = await interaction.client.fetch_user(case_dict["target_id"])
|
||||||
|
|
||||||
await interaction.guild.unban(
|
await interaction.guild.unban(
|
||||||
user, reason=f"Case #{case} resolved by {interaction.user.id}"
|
user,
|
||||||
|
reason=f"Case #{case} resolved by {interaction.user.id}",
|
||||||
)
|
)
|
||||||
except discord.NotFound:
|
except discord.NotFound:
|
||||||
pass
|
pass
|
||||||
|
@ -1340,7 +1336,8 @@ class Aurora(commands.Cog):
|
||||||
case_dict=await fetch_case(case, interaction.guild.id),
|
case_dict=await fetch_case(case, interaction.guild.id),
|
||||||
)
|
)
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"✅ Moderation #{case:,} resolved!", embed=embed
|
content=f"✅ Moderation #{case:,} resolved!",
|
||||||
|
embed=embed,
|
||||||
)
|
)
|
||||||
await log(interaction, case, resolved=True)
|
await log(interaction, case, resolved=True)
|
||||||
|
|
||||||
|
@ -1352,7 +1349,7 @@ class Aurora(commands.Cog):
|
||||||
export=[
|
export=[
|
||||||
Choice(name="Export as File", value="file"),
|
Choice(name="Export as File", value="file"),
|
||||||
Choice(name="Export as Codeblock", value="codeblock"),
|
Choice(name="Export as Codeblock", value="codeblock"),
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
async def case(
|
async def case(
|
||||||
self,
|
self,
|
||||||
|
@ -1376,41 +1373,35 @@ class Aurora(commands.Cog):
|
||||||
export: bool
|
export: bool
|
||||||
Export the case to a JSON file or codeblock"""
|
Export the case to a JSON file or codeblock"""
|
||||||
permissions = check_permissions(
|
permissions = check_permissions(
|
||||||
interaction.client.user, ["embed_links"], interaction
|
interaction.client.user,
|
||||||
|
["embed_links"],
|
||||||
|
interaction,
|
||||||
)
|
)
|
||||||
if permissions:
|
if permissions:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
error(
|
error(
|
||||||
f"I do not have the `{permissions}` permission, required for this action."
|
f"I do not have the `{permissions}` permission, required for this action.",
|
||||||
),
|
),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
if ephemeral is None:
|
if ephemeral is None:
|
||||||
ephemeral = (
|
ephemeral = await config.user(interaction.user).history_ephemeral() or await config.guild(interaction.guild).history_ephemeral() or False
|
||||||
await config.user(interaction.user).history_ephemeral()
|
|
||||||
or await config.guild(interaction.guild).history_ephemeral()
|
|
||||||
or False
|
|
||||||
)
|
|
||||||
|
|
||||||
if case != 0:
|
if case != 0:
|
||||||
case_dict = await fetch_case(case, interaction.guild.id)
|
case_dict = await fetch_case(case, interaction.guild.id)
|
||||||
if case_dict:
|
if case_dict:
|
||||||
if export:
|
if export:
|
||||||
if export.value == "file" or len(str(case_dict)) > 1800:
|
if export.value == "file" or len(str(case_dict)) > 1800:
|
||||||
filename = (
|
filename = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + f"moderation_{interaction.guild.id}_case_{case}.json"
|
||||||
str(data_manager.cog_data_path(cog_instance=self))
|
|
||||||
+ str(os.sep)
|
|
||||||
+ f"moderation_{interaction.guild.id}_case_{case}.json"
|
|
||||||
)
|
|
||||||
|
|
||||||
with open(filename, "w", encoding="utf-8") as f:
|
with open(filename, "w", encoding="utf-8") as f:
|
||||||
json.dump(case_dict, f, indent=2)
|
json.dump(case_dict, f, indent=2)
|
||||||
|
|
||||||
if export.value == "codeblock":
|
if export.value == "codeblock":
|
||||||
content = f"Case #{case:,} exported.\n" + warning(
|
content = f"Case #{case:,} exported.\n" + warning(
|
||||||
"Case was too large to export as codeblock, so it has been uploaded as a `.json` file."
|
"Case was too large to export as codeblock, so it has been uploaded as a `.json` file.",
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
content = f"Case #{case:,} exported."
|
content = f"Case #{case:,} exported."
|
||||||
|
@ -1427,34 +1418,41 @@ class Aurora(commands.Cog):
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
return
|
return
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=box(json.dumps(case_dict, indent=2), 'json'),
|
content=box(json.dumps(case_dict, indent=2), "json"),
|
||||||
ephemeral=ephemeral,
|
ephemeral=ephemeral,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
if changes:
|
if changes:
|
||||||
embed = await changes_factory(
|
embed = await changes_factory(
|
||||||
interaction=interaction, case_dict=case_dict
|
interaction=interaction,
|
||||||
|
case_dict=case_dict,
|
||||||
)
|
)
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
embed=embed, ephemeral=ephemeral
|
embed=embed,
|
||||||
|
ephemeral=ephemeral,
|
||||||
)
|
)
|
||||||
elif evidenceformat:
|
elif evidenceformat:
|
||||||
content = await evidenceformat_factory(
|
content = await evidenceformat_factory(
|
||||||
interaction=interaction, case_dict=case_dict
|
interaction=interaction,
|
||||||
|
case_dict=case_dict,
|
||||||
)
|
)
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=content, ephemeral=ephemeral
|
content=content,
|
||||||
|
ephemeral=ephemeral,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
embed = await case_factory(
|
embed = await case_factory(
|
||||||
interaction=interaction, case_dict=case_dict
|
interaction=interaction,
|
||||||
|
case_dict=case_dict,
|
||||||
)
|
)
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
embed=embed, ephemeral=ephemeral
|
embed=embed,
|
||||||
|
ephemeral=ephemeral,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"No case with case number `{case}` found.", ephemeral=True
|
content=f"No case with case number `{case}` found.",
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@app_commands.command(name="edit")
|
@app_commands.command(name="edit")
|
||||||
|
@ -1476,13 +1474,16 @@ class Aurora(commands.Cog):
|
||||||
duration: str
|
duration: str
|
||||||
What is the new duration? Does not reapply the moderation if it has already expired.
|
What is the new duration? Does not reapply the moderation if it has already expired.
|
||||||
"""
|
"""
|
||||||
|
end_timestamp = None
|
||||||
permissions = check_permissions(
|
permissions = check_permissions(
|
||||||
interaction.client.user, ["embed_links"], interaction
|
interaction.client.user,
|
||||||
|
["embed_links"],
|
||||||
|
interaction,
|
||||||
)
|
)
|
||||||
if permissions:
|
if permissions:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
error(
|
error(
|
||||||
f"I do not have the `{permissions}` permission, required for this action."
|
f"I do not have the `{permissions}` permission, required for this action.",
|
||||||
),
|
),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
|
@ -1496,26 +1497,25 @@ class Aurora(commands.Cog):
|
||||||
parsed_time = parse_timedelta(duration)
|
parsed_time = parse_timedelta(duration)
|
||||||
if parsed_time is None:
|
if parsed_time is None:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
error("Please provide a valid duration!"), ephemeral=True
|
error("Please provide a valid duration!"),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
end_timestamp = case_dict["timestamp"] + parsed_time.total_seconds()
|
end_timestamp = case_dict["timestamp"] + parsed_time.total_seconds()
|
||||||
|
|
||||||
if case_dict["moderation_type"] == "MUTE":
|
if case_dict["moderation_type"] == "MUTE":
|
||||||
if (
|
if (time.time() - case_dict["timestamp"]) + parsed_time.total_seconds() > 2419200:
|
||||||
time.time() - case_dict["timestamp"]
|
|
||||||
) + parsed_time.total_seconds() > 2419200:
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
error(
|
error(
|
||||||
"Please provide a duration that is less than 28 days from the initial moderation."
|
"Please provide a duration that is less than 28 days from the initial moderation.",
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
member = await interaction.guild.fetch_member(
|
member = await interaction.guild.fetch_member(
|
||||||
case_dict["target_id"]
|
case_dict["target_id"],
|
||||||
)
|
)
|
||||||
|
|
||||||
await member.timeout(
|
await member.timeout(
|
||||||
|
@ -1529,7 +1529,7 @@ class Aurora(commands.Cog):
|
||||||
if len(changes) > 25:
|
if len(changes) > 25:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error(
|
content=error(
|
||||||
"Due to limitations with Discord's embed system, you cannot edit a case more than 25 times."
|
"Due to limitations with Discord's embed system, you cannot edit a case more than 25 times.",
|
||||||
),
|
),
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
|
@ -1543,9 +1543,10 @@ class Aurora(commands.Cog):
|
||||||
"user_id": case_dict["moderator_id"],
|
"user_id": case_dict["moderator_id"],
|
||||||
"duration": case_dict["duration"],
|
"duration": case_dict["duration"],
|
||||||
"end_timestamp": case_dict["end_timestamp"],
|
"end_timestamp": case_dict["end_timestamp"],
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
if parsed_time:
|
if parsed_time:
|
||||||
|
assert end_timestamp is not None
|
||||||
changes.append(
|
changes.append(
|
||||||
{
|
{
|
||||||
"type": "EDIT",
|
"type": "EDIT",
|
||||||
|
@ -1554,7 +1555,7 @@ class Aurora(commands.Cog):
|
||||||
"user_id": interaction.user.id,
|
"user_id": interaction.user.id,
|
||||||
"duration": convert_timedelta_to_str(parsed_time),
|
"duration": convert_timedelta_to_str(parsed_time),
|
||||||
"end_timestamp": end_timestamp,
|
"end_timestamp": end_timestamp,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
changes.append(
|
changes.append(
|
||||||
|
@ -1565,7 +1566,7 @@ class Aurora(commands.Cog):
|
||||||
"user_id": interaction.user.id,
|
"user_id": interaction.user.id,
|
||||||
"duration": case_dict["duration"],
|
"duration": case_dict["duration"],
|
||||||
"end_timestamp": case_dict["end_timestamp"],
|
"end_timestamp": case_dict["end_timestamp"],
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
database = connect()
|
database = connect()
|
||||||
|
@ -1602,7 +1603,8 @@ class Aurora(commands.Cog):
|
||||||
database.close()
|
database.close()
|
||||||
return
|
return
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error(f"No case with case number `{case}` found."), ephemeral=True
|
content=error(f"No case with case number `{case}` found."),
|
||||||
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@tasks.loop(minutes=1)
|
@tasks.loop(minutes=1)
|
||||||
|
@ -1634,14 +1636,11 @@ class Aurora(commands.Cog):
|
||||||
unban_num = 0
|
unban_num = 0
|
||||||
for target_id, moderation_id in zip(target_ids, moderation_ids):
|
for target_id, moderation_id in zip(target_ids, moderation_ids):
|
||||||
user: discord.User = await self.bot.fetch_user(target_id)
|
user: discord.User = await self.bot.fetch_user(target_id)
|
||||||
name = (
|
name = f"{user.name}#{user.discriminator}" if user.discriminator != "0" else user.name
|
||||||
f"{user.name}#{user.discriminator}"
|
|
||||||
if user.discriminator != "0"
|
|
||||||
else user.name
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
await guild.unban(
|
await guild.unban(
|
||||||
user, reason=f"Automatic unban from case #{moderation_id}"
|
user,
|
||||||
|
reason=f"Automatic unban from case #{moderation_id}",
|
||||||
)
|
)
|
||||||
|
|
||||||
embed = await message_factory(
|
embed = await message_factory(
|
||||||
|
@ -1690,13 +1689,16 @@ class Aurora(commands.Cog):
|
||||||
role_ids = [row[2] for row in result]
|
role_ids = [row[2] for row in result]
|
||||||
|
|
||||||
for target_id, moderation_id, role_id in zip(
|
for target_id, moderation_id, role_id in zip(
|
||||||
target_ids, moderation_ids, role_ids
|
target_ids,
|
||||||
|
moderation_ids,
|
||||||
|
role_ids,
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
member = await guild.fetch_member(target_id)
|
member = await guild.fetch_member(target_id)
|
||||||
|
|
||||||
await member.remove_roles(
|
await member.remove_roles(
|
||||||
Object(role_id), reason=f"Automatic role removal from case #{moderation_id}"
|
Object(role_id),
|
||||||
|
reason=f"Automatic role removal from case #{moderation_id}",
|
||||||
)
|
)
|
||||||
|
|
||||||
removerole_num = removerole_num + 1
|
removerole_num = removerole_num + 1
|
||||||
|
@ -1725,13 +1727,16 @@ class Aurora(commands.Cog):
|
||||||
role_ids = [row[2] for row in result]
|
role_ids = [row[2] for row in result]
|
||||||
|
|
||||||
for target_id, moderation_id, role_id in zip(
|
for target_id, moderation_id, role_id in zip(
|
||||||
target_ids, moderation_ids, role_ids
|
target_ids,
|
||||||
|
moderation_ids,
|
||||||
|
role_ids,
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
member = await guild.fetch_member(target_id)
|
member = await guild.fetch_member(target_id)
|
||||||
|
|
||||||
await member.add_roles(
|
await member.add_roles(
|
||||||
Object(role_id), reason=f"Automatic role addition from case #{moderation_id}"
|
Object(role_id),
|
||||||
|
reason=f"Automatic role addition from case #{moderation_id}",
|
||||||
)
|
)
|
||||||
|
|
||||||
addrole_num = addrole_num + 1
|
addrole_num = addrole_num + 1
|
||||||
|
@ -1827,15 +1832,11 @@ class Aurora(commands.Cog):
|
||||||
@commands.admin()
|
@commands.admin()
|
||||||
async def aurora_import_aurora(self, ctx: commands.Context):
|
async def aurora_import_aurora(self, ctx: commands.Context):
|
||||||
"""Import moderation history from another bot using Aurora."""
|
"""Import moderation history from another bot using Aurora."""
|
||||||
if (
|
if ctx.message.attachments and ctx.message.attachments[0].content_type == "application/json; charset=utf-8":
|
||||||
ctx.message.attachments
|
|
||||||
and ctx.message.attachments[0].content_type
|
|
||||||
== "application/json; charset=utf-8"
|
|
||||||
):
|
|
||||||
message = await ctx.send(
|
message = await ctx.send(
|
||||||
warning(
|
warning(
|
||||||
"Are you sure you want to import moderations from another bot?\n**This will overwrite any moderations that already exist in this guild's moderation table.**\n*The import process will block the rest of your bot until it is complete.*"
|
"Are you sure you want to import moderations from another bot?\n**This will overwrite any moderations that already exist in this guild's moderation table.**\n*The import process will block the rest of your bot until it is complete.*",
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
await message.edit(view=ImportAuroraView(60, ctx, message))
|
await message.edit(view=ImportAuroraView(60, ctx, message))
|
||||||
else:
|
else:
|
||||||
|
@ -1845,20 +1846,16 @@ class Aurora(commands.Cog):
|
||||||
@commands.admin()
|
@commands.admin()
|
||||||
async def aurora_import_galacticbot(self, ctx: commands.Context):
|
async def aurora_import_galacticbot(self, ctx: commands.Context):
|
||||||
"""Import moderation history from GalacticBot."""
|
"""Import moderation history from GalacticBot."""
|
||||||
if (
|
if ctx.message.attachments and ctx.message.attachments[0].content_type == "application/json; charset=utf-8":
|
||||||
ctx.message.attachments
|
|
||||||
and ctx.message.attachments[0].content_type
|
|
||||||
== "application/json; charset=utf-8"
|
|
||||||
):
|
|
||||||
message = await ctx.send(
|
message = await ctx.send(
|
||||||
warning(
|
warning(
|
||||||
"Are you sure you want to import GalacticBot moderations?\n**This will overwrite any moderations that already exist in this guild's moderation table.**\n*The import process will block the rest of your bot until it is complete.*"
|
"Are you sure you want to import GalacticBot moderations?\n**This will overwrite any moderations that already exist in this guild's moderation table.**\n*The import process will block the rest of your bot until it is complete.*",
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
await message.edit(view=ImportGalacticBotView(60, ctx, message))
|
await message.edit(view=ImportGalacticBotView(60, ctx, message))
|
||||||
else:
|
else:
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
error("Please provide a valid GalacticBot moderation export file.")
|
error("Please provide a valid GalacticBot moderation export file."),
|
||||||
)
|
)
|
||||||
|
|
||||||
@aurora.command(aliases=["tdc", "td", "timedeltaconvert"])
|
@aurora.command(aliases=["tdc", "td", "timedeltaconvert"])
|
||||||
|
|
|
@ -17,13 +17,9 @@ class ImportAuroraView(ui.View):
|
||||||
self.message: Message = message
|
self.message: Message = message
|
||||||
|
|
||||||
@ui.button(label="Yes", style=ButtonStyle.success)
|
@ui.button(label="Yes", style=ButtonStyle.success)
|
||||||
async def import_button_y(
|
async def import_button_y(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
self, interaction: Interaction, button: ui.Button
|
|
||||||
): # pylint: disable=unused-argument
|
|
||||||
await self.message.delete()
|
await self.message.delete()
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message("Deleting original table...", ephemeral=True)
|
||||||
"Deleting original table...", ephemeral=True
|
|
||||||
)
|
|
||||||
|
|
||||||
database = connect()
|
database = connect()
|
||||||
cursor = database.cursor()
|
cursor = database.cursor()
|
||||||
|
@ -101,16 +97,10 @@ class ImportAuroraView(ui.View):
|
||||||
|
|
||||||
await interaction.edit_original_response(content="Import complete.")
|
await interaction.edit_original_response(content="Import complete.")
|
||||||
if failed_cases:
|
if failed_cases:
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(content="Import complete.\n" + warning("Failed to import the following cases:\n") + box(failed_cases))
|
||||||
content="Import complete.\n"
|
|
||||||
+ warning("Failed to import the following cases:\n")
|
|
||||||
+ box(failed_cases)
|
|
||||||
)
|
|
||||||
|
|
||||||
@ui.button(label="No", style=ButtonStyle.danger)
|
@ui.button(label="No", style=ButtonStyle.danger)
|
||||||
async def import_button_n(
|
async def import_button_n(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
self, interaction: Interaction, button: ui.Button
|
|
||||||
): # pylint: disable=unused-argument
|
|
||||||
await self.message.edit(content="Import cancelled.", view=None)
|
await self.message.edit(content="Import cancelled.", view=None)
|
||||||
await self.message.delete(10)
|
await self.message.delete(10)
|
||||||
await self.ctx.message.delete(10)
|
await self.ctx.message.delete(10)
|
||||||
|
|
|
@ -16,13 +16,9 @@ class ImportGalacticBotView(ui.View):
|
||||||
self.message: Message = message
|
self.message: Message = message
|
||||||
|
|
||||||
@ui.button(label="Yes", style=ButtonStyle.success)
|
@ui.button(label="Yes", style=ButtonStyle.success)
|
||||||
async def import_button_y(
|
async def import_button_y(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
self, interaction: Interaction, button: ui.Button
|
|
||||||
): # pylint: disable=unused-argument
|
|
||||||
await self.message.delete()
|
await self.message.delete()
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message("Deleting original table...", ephemeral=True)
|
||||||
"Deleting original table...", ephemeral=True
|
|
||||||
)
|
|
||||||
|
|
||||||
database = connect()
|
database = connect()
|
||||||
cursor = database.cursor()
|
cursor = database.cursor()
|
||||||
|
@ -92,9 +88,7 @@ class ImportGalacticBotView(ui.View):
|
||||||
if resolved_by is None:
|
if resolved_by is None:
|
||||||
resolved_by = "?"
|
resolved_by = "?"
|
||||||
if resolved_reason is None:
|
if resolved_reason is None:
|
||||||
resolved_reason = (
|
resolved_reason = "Could not get resolve reason during moderation import."
|
||||||
"Could not get resolve reason during moderation import."
|
|
||||||
)
|
|
||||||
if resolved_timestamp is None:
|
if resolved_timestamp is None:
|
||||||
resolved_timestamp = timestamp
|
resolved_timestamp = timestamp
|
||||||
changes = [
|
changes = [
|
||||||
|
@ -142,16 +136,10 @@ class ImportGalacticBotView(ui.View):
|
||||||
|
|
||||||
await interaction.edit_original_response(content="Import complete.")
|
await interaction.edit_original_response(content="Import complete.")
|
||||||
if failed_cases:
|
if failed_cases:
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(content="Import complete.\n" + warning("Failed to import the following cases:\n") + box(failed_cases))
|
||||||
content="Import complete.\n"
|
|
||||||
+ warning("Failed to import the following cases:\n")
|
|
||||||
+ box(failed_cases)
|
|
||||||
)
|
|
||||||
|
|
||||||
@ui.button(label="No", style=ButtonStyle.danger)
|
@ui.button(label="No", style=ButtonStyle.danger)
|
||||||
async def import_button_n(
|
async def import_button_n(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
self, interaction: Interaction, button: ui.Button
|
|
||||||
): # pylint: disable=unused-argument
|
|
||||||
await self.message.edit(content="Import cancelled.", view=None)
|
await self.message.edit(content="Import cancelled.", view=None)
|
||||||
await self.message.delete(10)
|
await self.message.delete(10)
|
||||||
await self.ctx.message.delete(10)
|
await self.ctx.message.delete(10)
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Addrole(ui.View):
|
||||||
return
|
return
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
async with config.guild(self.ctx.guild).addrole_whitelist() as addrole_whitelist:
|
async with config.guild(self.ctx.guild).addrole_whitelist() as addrole_whitelist:
|
||||||
addrole_whitelist: list # type hint
|
addrole_whitelist: list # type hint
|
||||||
for value in select.values:
|
for value in select.values:
|
||||||
if value.id in addrole_whitelist:
|
if value.id in addrole_whitelist:
|
||||||
addrole_whitelist.remove(value.id)
|
addrole_whitelist.remove(value.id)
|
||||||
|
@ -32,7 +32,7 @@ class Addrole(ui.View):
|
||||||
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
||||||
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's addrole whitelist."), ephemeral=True)
|
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's addrole whitelist."), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -41,7 +41,7 @@ class Addrole(ui.View):
|
||||||
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Close", style=ButtonStyle.gray)
|
@ui.button(label="Close", style=ButtonStyle.gray)
|
||||||
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Guild(ui.View):
|
||||||
await self.message.edit(view=None)
|
await self.message.edit(view=None)
|
||||||
|
|
||||||
@ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
|
@ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
|
||||||
async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def show_moderator(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -27,7 +27,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Use Discord Permissions", style=ButtonStyle.green, row=0)
|
@ui.button(label="Use Discord Permissions", style=ButtonStyle.green, row=0)
|
||||||
async def use_discord_permissions(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def use_discord_permissions(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -37,7 +37,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Respect Hierarchy", style=ButtonStyle.green, row=0)
|
@ui.button(label="Respect Hierarchy", style=ButtonStyle.green, row=0)
|
||||||
async def respect_heirarchy(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def respect_heirarchy(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -47,7 +47,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Ignore Modlog", style=ButtonStyle.green, row=0)
|
@ui.button(label="Ignore Modlog", style=ButtonStyle.green, row=0)
|
||||||
async def ignore_modlog(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def ignore_modlog(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -57,7 +57,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Ignore Other Bots", style=ButtonStyle.green, row=0)
|
@ui.button(label="Ignore Other Bots", style=ButtonStyle.green, row=0)
|
||||||
async def ignore_other_bots(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def ignore_other_bots(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -67,7 +67,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="DM Users", style=ButtonStyle.green, row=1)
|
@ui.button(label="DM Users", style=ButtonStyle.green, row=1)
|
||||||
async def dm_users(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def dm_users(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -77,7 +77,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=1)
|
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=1)
|
||||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -87,7 +87,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=1)
|
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=1)
|
||||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -97,7 +97,7 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="History Inline", style=ButtonStyle.green, row=1)
|
@ui.button(label="History Inline", style=ButtonStyle.green, row=1)
|
||||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -107,7 +107,11 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.select(placeholder="History Pagesize", options=create_pagesize_options(), row=2)
|
@ui.select(placeholder="History Pagesize", options=create_pagesize_options(), row=2)
|
||||||
async def pagesize(self, interaction: Interaction, select: ui.Select,):
|
async def pagesize(
|
||||||
|
self,
|
||||||
|
interaction: Interaction,
|
||||||
|
select: ui.Select,
|
||||||
|
):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -119,7 +123,11 @@ class Guild(ui.View):
|
||||||
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
await interaction.message.edit(embed=await guild_embed(self.ctx))
|
||||||
|
|
||||||
@ui.select(placeholder="History Inline Pagesize", options=create_pagesize_options(), row=3)
|
@ui.select(placeholder="History Inline Pagesize", options=create_pagesize_options(), row=3)
|
||||||
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,):
|
async def inline_pagesize(
|
||||||
|
self,
|
||||||
|
interaction: Interaction,
|
||||||
|
select: ui.Select,
|
||||||
|
):
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Immune(ui.View):
|
||||||
return
|
return
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
async with config.guild(self.ctx.guild).immune_roles() as immune_roles:
|
async with config.guild(self.ctx.guild).immune_roles() as immune_roles:
|
||||||
immune_roles: list # type hint
|
immune_roles: list # type hint
|
||||||
for value in select.values:
|
for value in select.values:
|
||||||
if value.id in immune_roles:
|
if value.id in immune_roles:
|
||||||
immune_roles.remove(value.id)
|
immune_roles.remove(value.id)
|
||||||
|
@ -32,7 +32,7 @@ class Immune(ui.View):
|
||||||
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
||||||
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's immune roles."), ephemeral=True)
|
await interaction.response.send_message(error("You must have the manage guild permission to clear the guild's immune roles."), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -41,7 +41,7 @@ class Immune(ui.View):
|
||||||
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Close", style=ButtonStyle.gray)
|
@ui.button(label="Close", style=ButtonStyle.gray)
|
||||||
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
|
||||||
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
await interaction.response.send_message(error("You can't do that!"), ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Overrides(ui.View):
|
||||||
await self.message.edit(view=None)
|
await self.message.edit(view=None)
|
||||||
|
|
||||||
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=0)
|
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=0)
|
||||||
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -32,7 +32,7 @@ class Overrides(ui.View):
|
||||||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
|
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
|
||||||
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -47,7 +47,7 @@ class Overrides(ui.View):
|
||||||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
|
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
|
||||||
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -62,7 +62,11 @@ class Overrides(ui.View):
|
||||||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||||
|
|
||||||
@ui.select(placeholder="Inline Pagesize", options=create_pagesize_options(), row=1)
|
@ui.select(placeholder="Inline Pagesize", options=create_pagesize_options(), row=1)
|
||||||
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,):
|
async def inline_pagesize(
|
||||||
|
self,
|
||||||
|
interaction: Interaction,
|
||||||
|
select: ui.Select,
|
||||||
|
):
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
@ -74,7 +78,11 @@ class Overrides(ui.View):
|
||||||
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
await interaction.message.edit(embed=await overrides_embed(self.ctx))
|
||||||
|
|
||||||
@ui.select(placeholder="Pagesize", options=create_pagesize_options(), row=2)
|
@ui.select(placeholder="Pagesize", options=create_pagesize_options(), row=2)
|
||||||
async def pagesize(self, interaction: Interaction, select: ui.Select,):
|
async def pagesize(
|
||||||
|
self,
|
||||||
|
interaction: Interaction,
|
||||||
|
select: ui.Select,
|
||||||
|
):
|
||||||
if self.ctx.author != interaction.user:
|
if self.ctx.author != interaction.user:
|
||||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
|
@ -8,23 +8,18 @@ from discord import Guild
|
||||||
from redbot.core import data_manager
|
from redbot.core import data_manager
|
||||||
|
|
||||||
from .logger import logger
|
from .logger import logger
|
||||||
from .utils import (convert_timedelta_to_str, generate_dict,
|
from .utils import convert_timedelta_to_str, generate_dict, get_next_case_number
|
||||||
get_next_case_number)
|
|
||||||
|
|
||||||
|
|
||||||
def connect() -> sqlite3.Connection:
|
def connect() -> sqlite3.Connection:
|
||||||
"""Connects to the SQLite database, and returns a connection object."""
|
"""Connects to the SQLite database, and returns a connection object."""
|
||||||
try:
|
try:
|
||||||
connection = sqlite3.connect(
|
return sqlite3.connect(database=data_manager.cog_data_path(raw_name="Aurora") / "aurora.db")
|
||||||
database=data_manager.cog_data_path(raw_name="Aurora") / "aurora.db"
|
|
||||||
)
|
|
||||||
return connection
|
|
||||||
|
|
||||||
except sqlite3.OperationalError as e:
|
except sqlite3.OperationalError as e:
|
||||||
logger.error("Unable to access the SQLite database!\nError:\n%s", e.msg)
|
logger.error("Unable to access the SQLite database!\nError:\n%s", e.msg)
|
||||||
raise ConnectionRefusedError(
|
msg = f"Unable to access the SQLite Database!\n{e.msg}"
|
||||||
f"Unable to access the SQLite Database!\n{e.msg}"
|
raise ConnectionRefusedError(msg) from e
|
||||||
) from e
|
|
||||||
|
|
||||||
|
|
||||||
async def create_guild_table(guild: Guild):
|
async def create_guild_table(guild: Guild):
|
||||||
|
|
|
@ -75,7 +75,9 @@ async def message_factory(
|
||||||
|
|
||||||
if await config.guild(guild).show_moderator() and moderator is not None:
|
if await config.guild(guild).show_moderator() and moderator is not None:
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Moderator", value=f"`{moderator.name} ({moderator.id})`", inline=False
|
name="Moderator",
|
||||||
|
value=f"`{moderator.name} ({moderator.id})`",
|
||||||
|
inline=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
embed.add_field(name="Reason", value=f"`{reason}`", inline=False)
|
embed.add_field(name="Reason", value=f"`{reason}`", inline=False)
|
||||||
|
@ -94,7 +96,9 @@ async def message_factory(
|
||||||
|
|
||||||
|
|
||||||
async def log_factory(
|
async def log_factory(
|
||||||
interaction: Interaction, case_dict: dict, resolved: bool = False
|
interaction: Interaction,
|
||||||
|
case_dict: dict,
|
||||||
|
resolved: bool = False,
|
||||||
) -> Embed:
|
) -> Embed:
|
||||||
"""This function creates a log embed from set parameters, meant for moderation logging.
|
"""This function creates a log embed from set parameters, meant for moderation logging.
|
||||||
|
|
||||||
|
@ -103,14 +107,11 @@ async def log_factory(
|
||||||
case_dict (dict): The case dictionary.
|
case_dict (dict): The case dictionary.
|
||||||
resolved (bool, optional): Whether the case is resolved or not. Defaults to False.
|
resolved (bool, optional): Whether the case is resolved or not. Defaults to False.
|
||||||
"""
|
"""
|
||||||
|
target_name = ""
|
||||||
if resolved:
|
if resolved:
|
||||||
if case_dict["target_type"] == "USER":
|
if case_dict["target_type"] == "USER":
|
||||||
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
|
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
|
||||||
target_name = (
|
target_name = f"`{target_user['name']}`" if target_user["discriminator"] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
|
||||||
f"`{target_user['name']}`"
|
|
||||||
if target_user["discriminator"] == "0"
|
|
||||||
else f"`{target_user['name']}#{target_user['discriminator']}`"
|
|
||||||
)
|
|
||||||
elif case_dict["target_type"] == "CHANNEL":
|
elif case_dict["target_type"] == "CHANNEL":
|
||||||
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
|
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
|
||||||
if target_user["mention"]:
|
if target_user["mention"]:
|
||||||
|
@ -119,11 +120,7 @@ async def log_factory(
|
||||||
target_name = f"`{target_user['name']}`"
|
target_name = f"`{target_user['name']}`"
|
||||||
|
|
||||||
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
|
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
|
||||||
moderator_name = (
|
moderator_name = f"`{moderator_user['name']}`" if moderator_user["discriminator"] == "0" else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
|
||||||
f"`{moderator_user['name']}`"
|
|
||||||
if moderator_user["discriminator"] == "0"
|
|
||||||
else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
|
|
||||||
)
|
|
||||||
|
|
||||||
embed = Embed(
|
embed = Embed(
|
||||||
title=f"📕 Case #{case_dict['moderation_id']:,} Resolved",
|
title=f"📕 Case #{case_dict['moderation_id']:,} Resolved",
|
||||||
|
@ -140,40 +137,24 @@ async def log_factory(
|
||||||
["hours", "minutes", "seconds"],
|
["hours", "minutes", "seconds"],
|
||||||
case_dict["duration"].split(":"),
|
case_dict["duration"].split(":"),
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
|
||||||
duration_embed = (
|
|
||||||
f"{humanize_timedelta(timedelta=td)} | <t:{case_dict['end_timestamp']}:R>"
|
|
||||||
if case_dict["expired"] == "0"
|
|
||||||
else str(humanize_timedelta(timedelta=td))
|
|
||||||
)
|
|
||||||
embed.description = (
|
|
||||||
embed.description
|
|
||||||
+ f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case_dict['expired'])}"
|
|
||||||
)
|
)
|
||||||
|
duration_embed = f"{humanize_timedelta(timedelta=td)} | <t:{case_dict['end_timestamp']}:R>" if case_dict["expired"] == "0" else str(humanize_timedelta(timedelta=td))
|
||||||
|
embed.description = embed.description + f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case_dict['expired'])}"
|
||||||
|
|
||||||
embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False)
|
embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False)
|
||||||
|
|
||||||
resolved_user = await fetch_user_dict(interaction.client, case_dict["resolved_by"])
|
resolved_user = await fetch_user_dict(interaction.client, case_dict["resolved_by"])
|
||||||
resolved_name = (
|
resolved_name = resolved_user["name"] if resolved_user["discriminator"] == "0" else f"{resolved_user['name']}#{resolved_user['discriminator']}"
|
||||||
resolved_user["name"]
|
|
||||||
if resolved_user["discriminator"] == "0"
|
|
||||||
else f"{resolved_user['name']}#{resolved_user['discriminator']}"
|
|
||||||
)
|
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Resolve Reason",
|
name="Resolve Reason",
|
||||||
value=f"Resolved by `{resolved_name}` ({resolved_user['id']}) for:\n"
|
value=f"Resolved by `{resolved_name}` ({resolved_user['id']}) for:\n" + box(case_dict["resolve_reason"]),
|
||||||
+ box(case_dict["resolve_reason"]),
|
|
||||||
inline=False,
|
inline=False,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if case_dict["target_type"] == "USER":
|
if case_dict["target_type"] == "USER":
|
||||||
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
|
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
|
||||||
target_name = (
|
target_name = f"`{target_user['name']}`" if target_user["discriminator"] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
|
||||||
f"`{target_user['name']}`"
|
|
||||||
if target_user["discriminator"] == "0"
|
|
||||||
else f"`{target_user['name']}#{target_user['discriminator']}`"
|
|
||||||
)
|
|
||||||
elif case_dict["target_type"] == "CHANNEL":
|
elif case_dict["target_type"] == "CHANNEL":
|
||||||
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
|
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
|
||||||
if target_user["mention"]:
|
if target_user["mention"]:
|
||||||
|
@ -182,11 +163,7 @@ async def log_factory(
|
||||||
target_name = f"`{target_user['name']}`"
|
target_name = f"`{target_user['name']}`"
|
||||||
|
|
||||||
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
|
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
|
||||||
moderator_name = (
|
moderator_name = f"`{moderator_user['name']}`" if moderator_user["discriminator"] == "0" else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
|
||||||
f"`{moderator_user['name']}`"
|
|
||||||
if moderator_user["discriminator"] == "0"
|
|
||||||
else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
|
|
||||||
)
|
|
||||||
|
|
||||||
embed = Embed(
|
embed = Embed(
|
||||||
title=f"📕 Case #{case_dict['moderation_id']:,}",
|
title=f"📕 Case #{case_dict['moderation_id']:,}",
|
||||||
|
@ -202,12 +179,9 @@ async def log_factory(
|
||||||
["hours", "minutes", "seconds"],
|
["hours", "minutes", "seconds"],
|
||||||
case_dict["duration"].split(":"),
|
case_dict["duration"].split(":"),
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
|
||||||
embed.description = (
|
|
||||||
embed.description
|
|
||||||
+ f"\n**Duration:** {humanize_timedelta(timedelta=td)} | <t:{case_dict['end_timestamp']}:R>"
|
|
||||||
)
|
)
|
||||||
|
embed.description = embed.description + f"\n**Duration:** {humanize_timedelta(timedelta=td)} | <t:{case_dict['end_timestamp']}:R>"
|
||||||
|
|
||||||
embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False)
|
embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False)
|
||||||
return embed
|
return embed
|
||||||
|
@ -220,13 +194,10 @@ async def case_factory(interaction: Interaction, case_dict: dict) -> Embed:
|
||||||
interaction (Interaction): The interaction object.
|
interaction (Interaction): The interaction object.
|
||||||
case_dict (dict): The case dictionary.
|
case_dict (dict): The case dictionary.
|
||||||
"""
|
"""
|
||||||
|
target_name = ""
|
||||||
if case_dict["target_type"] == "USER":
|
if case_dict["target_type"] == "USER":
|
||||||
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
|
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
|
||||||
target_name = (
|
target_name = f"`{target_user['name']}`" if target_user["discriminator"] == "0" else f"`{target_user['name']}#{target_user['discriminator']}`"
|
||||||
f"`{target_user['name']}`"
|
|
||||||
if target_user["discriminator"] == "0"
|
|
||||||
else f"`{target_user['name']}#{target_user['discriminator']}`"
|
|
||||||
)
|
|
||||||
elif case_dict["target_type"] == "CHANNEL":
|
elif case_dict["target_type"] == "CHANNEL":
|
||||||
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
|
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
|
||||||
if target_user["mention"]:
|
if target_user["mention"]:
|
||||||
|
@ -235,11 +206,7 @@ async def case_factory(interaction: Interaction, case_dict: dict) -> Embed:
|
||||||
target_name = f"`{target_user['name']}`"
|
target_name = f"`{target_user['name']}`"
|
||||||
|
|
||||||
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
|
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
|
||||||
moderator_name = (
|
moderator_name = f"`{moderator_user['name']}`" if moderator_user["discriminator"] == "0" else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
|
||||||
f"`{moderator_user['name']}`"
|
|
||||||
if moderator_user["discriminator"] == "0"
|
|
||||||
else f"`{moderator_user['name']}#{moderator_user['discriminator']}`"
|
|
||||||
)
|
|
||||||
|
|
||||||
embed = Embed(
|
embed = Embed(
|
||||||
title=f"📕 Case #{case_dict['moderation_id']:,}",
|
title=f"📕 Case #{case_dict['moderation_id']:,}",
|
||||||
|
@ -252,41 +219,28 @@ async def case_factory(interaction: Interaction, case_dict: dict) -> Embed:
|
||||||
**{
|
**{
|
||||||
unit: int(val)
|
unit: int(val)
|
||||||
for unit, val in zip(
|
for unit, val in zip(
|
||||||
["hours", "minutes", "seconds"], case_dict["duration"].split(":")
|
["hours", "minutes", "seconds"],
|
||||||
|
case_dict["duration"].split(":"),
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
|
||||||
duration_embed = (
|
|
||||||
f"{humanize_timedelta(timedelta=td)} | <t:{case_dict['end_timestamp']}:R>"
|
|
||||||
if bool(case_dict["expired"]) is False
|
|
||||||
else str(humanize_timedelta(timedelta=td))
|
|
||||||
)
|
)
|
||||||
|
duration_embed = f"{humanize_timedelta(timedelta=td)} | <t:{case_dict['end_timestamp']}:R>" if bool(case_dict["expired"]) is False else str(humanize_timedelta(timedelta=td))
|
||||||
embed.description += f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case_dict['expired'])}"
|
embed.description += f"\n**Duration:** {duration_embed}\n**Expired:** {bool(case_dict['expired'])}"
|
||||||
|
|
||||||
embed.description += (
|
embed.description += f"\n**Changes:** {len(case_dict['changes']) - 1}" if case_dict["changes"] else "\n**Changes:** 0"
|
||||||
f"\n**Changes:** {len(case_dict['changes']) - 1}"
|
|
||||||
if case_dict["changes"]
|
|
||||||
else "\n**Changes:** 0"
|
|
||||||
)
|
|
||||||
|
|
||||||
if case_dict["role_id"]:
|
if case_dict["role_id"]:
|
||||||
embed.description += f"\n**Role:** <@&{case_dict['role_id']}>"
|
embed.description += f"\n**Role:** <@&{case_dict['role_id']}>"
|
||||||
|
|
||||||
if case_dict["metadata"]:
|
if case_dict["metadata"]:
|
||||||
if case_dict["metadata"]["imported_from"]:
|
if case_dict["metadata"]["imported_from"]:
|
||||||
embed.description += (
|
embed.description += f"\n**Imported From:** {case_dict['metadata']['imported_from']}"
|
||||||
f"\n**Imported From:** {case_dict['metadata']['imported_from']}"
|
|
||||||
)
|
|
||||||
|
|
||||||
embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False)
|
embed.add_field(name="Reason", value=box(case_dict["reason"]), inline=False)
|
||||||
|
|
||||||
if case_dict["resolved"] == 1:
|
if case_dict["resolved"] == 1:
|
||||||
resolved_user = await fetch_user_dict(interaction.client, case_dict["resolved_by"])
|
resolved_user = await fetch_user_dict(interaction.client, case_dict["resolved_by"])
|
||||||
resolved_name = (
|
resolved_name = f"`{resolved_user['name']}`" if resolved_user["discriminator"] == "0" else f"`{resolved_user['name']}#{resolved_user['discriminator']}`"
|
||||||
f"`{resolved_user['name']}`"
|
|
||||||
if resolved_user["discriminator"] == "0"
|
|
||||||
else f"`{resolved_user['name']}#{resolved_user['discriminator']}`"
|
|
||||||
)
|
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Resolve Reason",
|
name="Resolve Reason",
|
||||||
value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n{box(case_dict['resolve_reason'])}",
|
value=f"Resolved by {resolved_name} ({resolved_user['id']}) for:\n{box(case_dict['resolve_reason'])}",
|
||||||
|
@ -314,15 +268,12 @@ async def changes_factory(interaction: Interaction, case_dict: dict) -> Embed:
|
||||||
for change in case_dict["changes"]:
|
for change in case_dict["changes"]:
|
||||||
if change["user_id"] not in memory_dict:
|
if change["user_id"] not in memory_dict:
|
||||||
memory_dict[str(change["user_id"])] = await fetch_user_dict(
|
memory_dict[str(change["user_id"])] = await fetch_user_dict(
|
||||||
interaction.client, change["user_id"]
|
interaction.client,
|
||||||
|
change["user_id"],
|
||||||
)
|
)
|
||||||
|
|
||||||
user = memory_dict[str(change["user_id"])]
|
user = memory_dict[str(change["user_id"])]
|
||||||
name = (
|
name = user["name"] if user["discriminator"] == "0" else f"{user['name']}#{user['discriminator']}"
|
||||||
user["name"]
|
|
||||||
if user["discriminator"] == "0"
|
|
||||||
else f"{user['name']}#{user['discriminator']}"
|
|
||||||
)
|
|
||||||
|
|
||||||
timestamp = f"<t:{change['timestamp']}> | <t:{change['timestamp']}:R>"
|
timestamp = f"<t:{change['timestamp']}> | <t:{change['timestamp']}:R>"
|
||||||
|
|
||||||
|
@ -360,24 +311,17 @@ async def evidenceformat_factory(interaction: Interaction, case_dict: dict) -> s
|
||||||
interaction (Interaction): The interaction object.
|
interaction (Interaction): The interaction object.
|
||||||
case_dict (dict): The case dictionary.
|
case_dict (dict): The case dictionary.
|
||||||
"""
|
"""
|
||||||
|
target_name = ""
|
||||||
if case_dict["target_type"] == "USER":
|
if case_dict["target_type"] == "USER":
|
||||||
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
|
target_user = await fetch_user_dict(interaction.client, case_dict["target_id"])
|
||||||
target_name = (
|
target_name = target_user["name"] if target_user["discriminator"] == "0" else f"{target_user['name']}#{target_user['discriminator']}"
|
||||||
target_user["name"]
|
|
||||||
if target_user["discriminator"] == "0"
|
|
||||||
else f"{target_user['name']}#{target_user['discriminator']}"
|
|
||||||
)
|
|
||||||
|
|
||||||
elif case_dict["target_type"] == "CHANNEL":
|
elif case_dict["target_type"] == "CHANNEL":
|
||||||
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
|
target_user = await fetch_channel_dict(interaction.guild, case_dict["target_id"])
|
||||||
target_name = target_user["name"]
|
target_name = target_user["name"]
|
||||||
|
|
||||||
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
|
moderator_user = await fetch_user_dict(interaction.client, case_dict["moderator_id"])
|
||||||
moderator_name = (
|
moderator_name = moderator_user["name"] if moderator_user["discriminator"] == "0" else f"{moderator_user['name']}#{moderator_user['discriminator']}"
|
||||||
moderator_user["name"]
|
|
||||||
if moderator_user["discriminator"] == "0"
|
|
||||||
else f"{moderator_user['name']}#{moderator_user['discriminator']}"
|
|
||||||
)
|
|
||||||
|
|
||||||
content = f"Case: {case_dict['moderation_id']:,} ({str.title(case_dict['moderation_type'])})\nTarget: {target_name} ({target_user['id']})\nModerator: {moderator_name} ({moderator_user['id']})"
|
content = f"Case: {case_dict['moderation_id']:,} ({str.title(case_dict['moderation_type'])})\nTarget: {target_name} ({target_user['id']})\nModerator: {moderator_name} ({moderator_user['id']})"
|
||||||
|
|
||||||
|
@ -419,17 +363,11 @@ async def overrides_embed(ctx: commands.Context) -> Embed:
|
||||||
}
|
}
|
||||||
|
|
||||||
override_str = [
|
override_str = [
|
||||||
"- "
|
"- " + bold("Auto Evidence Format: ") + get_bool_emoji(override_settings["auto_evidenceformat"]),
|
||||||
+ bold("Auto Evidence Format: ")
|
|
||||||
+ get_bool_emoji(override_settings["auto_evidenceformat"]),
|
|
||||||
"- " + bold("Ephemeral: ") + get_bool_emoji(override_settings["ephemeral"]),
|
"- " + bold("Ephemeral: ") + get_bool_emoji(override_settings["ephemeral"]),
|
||||||
"- " + bold("History Inline: ") + get_bool_emoji(override_settings["inline"]),
|
"- " + bold("History Inline: ") + get_bool_emoji(override_settings["inline"]),
|
||||||
"- "
|
"- " + bold("History Inline Pagesize: ") + get_pagesize_str(override_settings["inline_pagesize"]),
|
||||||
+ bold("History Inline Pagesize: ")
|
"- " + bold("History Pagesize: ") + get_pagesize_str(override_settings["pagesize"]),
|
||||||
+ get_pagesize_str(override_settings["inline_pagesize"]),
|
|
||||||
"- "
|
|
||||||
+ bold("History Pagesize: ")
|
|
||||||
+ get_pagesize_str(override_settings["pagesize"]),
|
|
||||||
]
|
]
|
||||||
override_str = "\n".join(override_str)
|
override_str = "\n".join(override_str)
|
||||||
|
|
||||||
|
@ -451,7 +389,7 @@ async def guild_embed(ctx: commands.Context) -> Embed:
|
||||||
guild_settings = {
|
guild_settings = {
|
||||||
"show_moderator": await config.guild(ctx.guild).show_moderator(),
|
"show_moderator": await config.guild(ctx.guild).show_moderator(),
|
||||||
"use_discord_permissions": await config.guild(
|
"use_discord_permissions": await config.guild(
|
||||||
ctx.guild
|
ctx.guild,
|
||||||
).use_discord_permissions(),
|
).use_discord_permissions(),
|
||||||
"ignore_modlog": await config.guild(ctx.guild).ignore_modlog(),
|
"ignore_modlog": await config.guild(ctx.guild).ignore_modlog(),
|
||||||
"ignore_other_bots": await config.guild(ctx.guild).ignore_other_bots(),
|
"ignore_other_bots": await config.guild(ctx.guild).ignore_other_bots(),
|
||||||
|
@ -461,7 +399,7 @@ async def guild_embed(ctx: commands.Context) -> Embed:
|
||||||
"history_inline": await config.guild(ctx.guild).history_inline(),
|
"history_inline": await config.guild(ctx.guild).history_inline(),
|
||||||
"history_pagesize": await config.guild(ctx.guild).history_pagesize(),
|
"history_pagesize": await config.guild(ctx.guild).history_pagesize(),
|
||||||
"history_inline_pagesize": await config.guild(
|
"history_inline_pagesize": await config.guild(
|
||||||
ctx.guild
|
ctx.guild,
|
||||||
).history_inline_pagesize(),
|
).history_inline_pagesize(),
|
||||||
"auto_evidenceformat": await config.guild(ctx.guild).auto_evidenceformat(),
|
"auto_evidenceformat": await config.guild(ctx.guild).auto_evidenceformat(),
|
||||||
"respect_hierarchy": await config.guild(ctx.guild).respect_hierarchy(),
|
"respect_hierarchy": await config.guild(ctx.guild).respect_hierarchy(),
|
||||||
|
@ -474,37 +412,17 @@ async def guild_embed(ctx: commands.Context) -> Embed:
|
||||||
channel = channel.mention
|
channel = channel.mention
|
||||||
|
|
||||||
guild_str = [
|
guild_str = [
|
||||||
"- "
|
"- " + bold("Show Moderator: ") + get_bool_emoji(guild_settings["show_moderator"]),
|
||||||
+ bold("Show Moderator: ")
|
"- " + bold("Use Discord Permissions: ") + get_bool_emoji(guild_settings["use_discord_permissions"]),
|
||||||
+ get_bool_emoji(guild_settings["show_moderator"]),
|
"- " + bold("Respect Hierarchy: ") + get_bool_emoji(guild_settings["respect_hierarchy"]),
|
||||||
"- "
|
"- " + bold("Ignore Modlog: ") + get_bool_emoji(guild_settings["ignore_modlog"]),
|
||||||
+ bold("Use Discord Permissions: ")
|
"- " + bold("Ignore Other Bots: ") + get_bool_emoji(guild_settings["ignore_other_bots"]),
|
||||||
+ get_bool_emoji(guild_settings["use_discord_permissions"]),
|
|
||||||
"- "
|
|
||||||
+ bold("Respect Hierarchy: ")
|
|
||||||
+ get_bool_emoji(guild_settings["respect_hierarchy"]),
|
|
||||||
"- "
|
|
||||||
+ bold("Ignore Modlog: ")
|
|
||||||
+ get_bool_emoji(guild_settings["ignore_modlog"]),
|
|
||||||
"- "
|
|
||||||
+ bold("Ignore Other Bots: ")
|
|
||||||
+ get_bool_emoji(guild_settings["ignore_other_bots"]),
|
|
||||||
"- " + bold("DM Users: ") + get_bool_emoji(guild_settings["dm_users"]),
|
"- " + bold("DM Users: ") + get_bool_emoji(guild_settings["dm_users"]),
|
||||||
"- "
|
"- " + bold("Auto Evidence Format: ") + get_bool_emoji(guild_settings["auto_evidenceformat"]),
|
||||||
+ bold("Auto Evidence Format: ")
|
"- " + bold("Ephemeral: ") + get_bool_emoji(guild_settings["history_ephemeral"]),
|
||||||
+ get_bool_emoji(guild_settings["auto_evidenceformat"]),
|
"- " + bold("History Inline: ") + get_bool_emoji(guild_settings["history_inline"]),
|
||||||
"- "
|
"- " + bold("History Pagesize: ") + get_pagesize_str(guild_settings["history_pagesize"]),
|
||||||
+ bold("Ephemeral: ")
|
"- " + bold("History Inline Pagesize: ") + get_pagesize_str(guild_settings["history_inline_pagesize"]),
|
||||||
+ get_bool_emoji(guild_settings["history_ephemeral"]),
|
|
||||||
"- "
|
|
||||||
+ bold("History Inline: ")
|
|
||||||
+ get_bool_emoji(guild_settings["history_inline"]),
|
|
||||||
"- "
|
|
||||||
+ bold("History Pagesize: ")
|
|
||||||
+ get_pagesize_str(guild_settings["history_pagesize"]),
|
|
||||||
"- "
|
|
||||||
+ bold("History Inline Pagesize: ")
|
|
||||||
+ get_pagesize_str(guild_settings["history_inline_pagesize"]),
|
|
||||||
"- " + bold("Log Channel: ") + channel,
|
"- " + bold("Log Channel: ") + channel,
|
||||||
]
|
]
|
||||||
guild_str = "\n".join(guild_str)
|
guild_str = "\n".join(guild_str)
|
||||||
|
@ -528,17 +446,21 @@ async def addrole_embed(ctx: commands.Context) -> Embed:
|
||||||
for role in whitelist:
|
for role in whitelist:
|
||||||
evalulated_role = ctx.guild.get_role(role) or error(f"`{role}` (Not Found)")
|
evalulated_role = ctx.guild.get_role(role) or error(f"`{role}` (Not Found)")
|
||||||
if isinstance(evalulated_role, Role):
|
if isinstance(evalulated_role, Role):
|
||||||
roles.append({
|
roles.append(
|
||||||
"id": evalulated_role.id,
|
{
|
||||||
"mention": evalulated_role.mention,
|
"id": evalulated_role.id,
|
||||||
"position": evalulated_role.position
|
"mention": evalulated_role.mention,
|
||||||
})
|
"position": evalulated_role.position,
|
||||||
|
},
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
roles.append({
|
roles.append(
|
||||||
"id": role,
|
{
|
||||||
"mention": error(f"`{role}` (Not Found)"),
|
"id": role,
|
||||||
"position": 0
|
"mention": error(f"`{role}` (Not Found)"),
|
||||||
})
|
"position": 0,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
if roles:
|
if roles:
|
||||||
roles = sorted(roles, key=lambda x: x["position"], reverse=True)
|
roles = sorted(roles, key=lambda x: x["position"], reverse=True)
|
||||||
|
@ -549,9 +471,7 @@ async def addrole_embed(ctx: commands.Context) -> Embed:
|
||||||
|
|
||||||
e = await _config(ctx)
|
e = await _config(ctx)
|
||||||
e.title += ": Addrole Whitelist"
|
e.title += ": Addrole Whitelist"
|
||||||
e.description = (
|
e.description = "Use the select menu below to manage this guild's addrole whitelist."
|
||||||
"Use the select menu below to manage this guild's addrole whitelist."
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(whitelist_str) > 4000 and len(whitelist_str) < 5000:
|
if len(whitelist_str) > 4000 and len(whitelist_str) < 5000:
|
||||||
lines = whitelist_str.split("\n")
|
lines = whitelist_str.split("\n")
|
||||||
|
@ -581,17 +501,21 @@ async def immune_embed(ctx: commands.Context) -> Embed:
|
||||||
for role in immune_roles:
|
for role in immune_roles:
|
||||||
evalulated_role = ctx.guild.get_role(role) or error(f"`{role}` (Not Found)")
|
evalulated_role = ctx.guild.get_role(role) or error(f"`{role}` (Not Found)")
|
||||||
if isinstance(evalulated_role, Role):
|
if isinstance(evalulated_role, Role):
|
||||||
roles.append({
|
roles.append(
|
||||||
"id": evalulated_role.id,
|
{
|
||||||
"mention": evalulated_role.mention,
|
"id": evalulated_role.id,
|
||||||
"position": evalulated_role.position
|
"mention": evalulated_role.mention,
|
||||||
})
|
"position": evalulated_role.position,
|
||||||
|
},
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
roles.append({
|
roles.append(
|
||||||
"id": role,
|
{
|
||||||
"mention": error(f"`{role}` (Not Found)"),
|
"id": role,
|
||||||
"position": 0
|
"mention": error(f"`{role}` (Not Found)"),
|
||||||
})
|
"position": 0,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
if roles:
|
if roles:
|
||||||
roles = sorted(roles, key=lambda x: x["position"], reverse=True)
|
roles = sorted(roles, key=lambda x: x["position"], reverse=True)
|
||||||
|
|
|
@ -32,24 +32,17 @@ def check_permissions(
|
||||||
raise (KeyError)
|
raise (KeyError)
|
||||||
|
|
||||||
for permission in permissions:
|
for permission in permissions:
|
||||||
if (
|
if not getattr(resolved_permissions, permission, False) and resolved_permissions.administrator is not True:
|
||||||
not getattr(resolved_permissions, permission, False)
|
|
||||||
and resolved_permissions.administrator is not True
|
|
||||||
):
|
|
||||||
return permission
|
return permission
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
async def check_moddable(
|
async def check_moddable(target: Union[User, Member], interaction: Interaction, permissions: list) -> bool:
|
||||||
target: Union[User, Member], interaction: Interaction, permissions: list
|
|
||||||
) -> bool:
|
|
||||||
"""Checks if a moderator can moderate a target."""
|
"""Checks if a moderator can moderate a target."""
|
||||||
if check_permissions(interaction.client.user, permissions, guild=interaction.guild):
|
if check_permissions(interaction.client.user, permissions, guild=interaction.guild):
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
error(
|
error(f"I do not have the `{permissions}` permission, required for this action."),
|
||||||
f"I do not have the `{permissions}` permission, required for this action."
|
|
||||||
),
|
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
@ -57,43 +50,30 @@ async def check_moddable(
|
||||||
if await config.guild(interaction.guild).use_discord_permissions() is True:
|
if await config.guild(interaction.guild).use_discord_permissions() is True:
|
||||||
if check_permissions(interaction.user, permissions, guild=interaction.guild):
|
if check_permissions(interaction.user, permissions, guild=interaction.guild):
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
error(
|
error(f"You do not have the `{permissions}` permission, required for this action."),
|
||||||
f"You do not have the `{permissions}` permission, required for this action."
|
|
||||||
),
|
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if interaction.user.id == target.id:
|
if interaction.user.id == target.id:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(content="You cannot moderate yourself!", ephemeral=True)
|
||||||
content="You cannot moderate yourself!", ephemeral=True
|
|
||||||
)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if target.bot:
|
if target.bot:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(content="You cannot moderate bots!", ephemeral=True)
|
||||||
content="You cannot moderate bots!", ephemeral=True
|
|
||||||
)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if isinstance(target, Member):
|
if isinstance(target, Member):
|
||||||
if interaction.user.top_role <= target.top_role and await config.guild(interaction.guild).respect_hierarchy() is True:
|
if interaction.user.top_role <= target.top_role and await config.guild(interaction.guild).respect_hierarchy() is True:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error(
|
content=error("You cannot moderate members with a higher role than you!"),
|
||||||
"You cannot moderate members with a higher role than you!"
|
|
||||||
),
|
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if (
|
if interaction.guild.get_member(interaction.client.user.id).top_role <= target.top_role:
|
||||||
interaction.guild.get_member(interaction.client.user.id).top_role
|
|
||||||
<= target.top_role
|
|
||||||
):
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=error(
|
content=error("You cannot moderate members with a role higher than the bot!"),
|
||||||
"You cannot moderate members with a role higher than the bot!"
|
|
||||||
),
|
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
@ -118,15 +98,13 @@ async def get_next_case_number(guild_id: str, cursor=None) -> int:
|
||||||
if not cursor:
|
if not cursor:
|
||||||
database = connect()
|
database = connect()
|
||||||
cursor = database.cursor()
|
cursor = database.cursor()
|
||||||
cursor.execute(
|
cursor.execute(f"SELECT moderation_id FROM `moderation_{guild_id}` ORDER BY moderation_id DESC LIMIT 1")
|
||||||
f"SELECT moderation_id FROM `moderation_{guild_id}` ORDER BY moderation_id DESC LIMIT 1"
|
|
||||||
)
|
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
return (result[0] + 1) if result else 1
|
return (result[0] + 1) if result else 1
|
||||||
|
|
||||||
|
|
||||||
def generate_dict(result) -> dict:
|
def generate_dict(result) -> dict:
|
||||||
case = {
|
return {
|
||||||
"moderation_id": result[0],
|
"moderation_id": result[0],
|
||||||
"timestamp": result[1],
|
"timestamp": result[1],
|
||||||
"moderation_type": result[2],
|
"moderation_type": result[2],
|
||||||
|
@ -144,7 +122,6 @@ def generate_dict(result) -> dict:
|
||||||
"changes": json.loads(result[14]),
|
"changes": json.loads(result[14]),
|
||||||
"metadata": json.loads(result[15]),
|
"metadata": json.loads(result[15]),
|
||||||
}
|
}
|
||||||
return case
|
|
||||||
|
|
||||||
|
|
||||||
async def fetch_user_dict(client: commands.Bot, user_id: str) -> dict:
|
async def fetch_user_dict(client: commands.Bot, user_id: str) -> dict:
|
||||||
|
@ -171,7 +148,6 @@ async def fetch_user_dict(client: commands.Bot, user_id: str) -> dict:
|
||||||
"discriminator": "0",
|
"discriminator": "0",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return user_dict
|
return user_dict
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,11 +174,9 @@ async def fetch_role_dict(guild: Guild, role_id: int) -> dict:
|
||||||
"""This function returns a dictionary containing either role information or a standard deleted role template."""
|
"""This function returns a dictionary containing either role information or a standard deleted role template."""
|
||||||
role = guild.get_role(int(role_id))
|
role = guild.get_role(int(role_id))
|
||||||
if not role:
|
if not role:
|
||||||
role_dict = {"id": role_id, "name": "Deleted Role"}
|
pass
|
||||||
|
|
||||||
role_dict = {"id": role.id, "name": role.name}
|
return {"id": role.id, "name": role.name}
|
||||||
|
|
||||||
return role_dict
|
|
||||||
|
|
||||||
|
|
||||||
async def log(interaction: Interaction, moderation_id: int, resolved: bool = False) -> None:
|
async def log(interaction: Interaction, moderation_id: int, resolved: bool = False) -> None:
|
||||||
|
@ -216,9 +190,7 @@ async def log(interaction: Interaction, moderation_id: int, resolved: bool = Fal
|
||||||
|
|
||||||
case = await fetch_case(moderation_id, interaction.guild.id)
|
case = await fetch_case(moderation_id, interaction.guild.id)
|
||||||
if case:
|
if case:
|
||||||
embed = await log_factory(
|
embed = await log_factory(interaction=interaction, case_dict=case, resolved=resolved)
|
||||||
interaction=interaction, case_dict=case, resolved=resolved
|
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
await logging_channel.send(embed=embed)
|
await logging_channel.send(embed=embed)
|
||||||
except Forbidden:
|
except Forbidden:
|
||||||
|
@ -229,11 +201,7 @@ async def send_evidenceformat(interaction: Interaction, case_dict: dict) -> None
|
||||||
"""This function sends an ephemeral message to the moderator who took the moderation action, with a pre-made codeblock for use in the mod-evidence channel."""
|
"""This function sends an ephemeral message to the moderator who took the moderation action, with a pre-made codeblock for use in the mod-evidence channel."""
|
||||||
from .factory import evidenceformat_factory
|
from .factory import evidenceformat_factory
|
||||||
|
|
||||||
send_evidence_bool = (
|
send_evidence_bool = await config.user(interaction.user).auto_evidenceformat() or await config.guild(interaction.guild).auto_evidenceformat() or False
|
||||||
await config.user(interaction.user).auto_evidenceformat()
|
|
||||||
or await config.guild(interaction.guild).auto_evidenceformat()
|
|
||||||
or False
|
|
||||||
)
|
|
||||||
if send_evidence_bool is False:
|
if send_evidence_bool is False:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -274,24 +242,19 @@ def create_pagesize_options() -> list[SelectOption]:
|
||||||
label="Default",
|
label="Default",
|
||||||
value="default",
|
value="default",
|
||||||
description="Reset the pagesize to the default value.",
|
description="Reset the pagesize to the default value.",
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
for i in range(1, 21):
|
options.extend(SelectOption(label=str(i), value=str(i), description=f"Set the pagesize to {i}") for i in range(1, 21))
|
||||||
options.append(
|
|
||||||
SelectOption(
|
|
||||||
label=str(i),
|
|
||||||
value=str(i),
|
|
||||||
description=f"Set the pagesize to {i}.",
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
def timedelta_from_relativedelta(relativedelta: rd) -> td:
|
def timedelta_from_relativedelta(relativedelta: rd) -> td:
|
||||||
"""Converts a relativedelta object to a timedelta object."""
|
"""Converts a relativedelta object to a timedelta object."""
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
then = now - relativedelta
|
then = now - relativedelta
|
||||||
return now - then
|
return now - then
|
||||||
|
|
||||||
|
|
||||||
def get_footer_image(coginstance: commands.Cog) -> File:
|
def get_footer_image(coginstance: commands.Cog) -> File:
|
||||||
"""Returns the footer image for the embeds."""
|
"""Returns the footer image for the embeds."""
|
||||||
image_path = data_manager.bundled_data_path(coginstance) / "arrow.png"
|
image_path = data_manager.bundled_data_path(coginstance) / "arrow.png"
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Backup(commands.Cog):
|
||||||
|
|
||||||
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
||||||
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
||||||
__version__ = "1.1.3"
|
__version__ = "1.1.4"
|
||||||
__documentation__ = "https://seacogs.coastalcommits.com/backup/"
|
__documentation__ = "https://seacogs.coastalcommits.com/backup/"
|
||||||
|
|
||||||
def __init__(self, bot: Red):
|
def __init__(self, bot: Red):
|
||||||
|
@ -49,7 +49,6 @@ class Backup(commands.Cog):
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def backup(self, ctx: commands.Context) -> None:
|
async def backup(self, ctx: commands.Context) -> None:
|
||||||
"""Backup your installed cogs."""
|
"""Backup your installed cogs."""
|
||||||
pass
|
|
||||||
|
|
||||||
@backup.command(name="export")
|
@backup.command(name="export")
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"hidden": false,
|
"hidden": false,
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
"min_bot_version": "3.5.6",
|
"min_bot_version": "3.5.6",
|
||||||
"max_bot_version": "3.5.16",
|
"max_bot_version": "3.5.17",
|
||||||
"min_python_version": [
|
"min_python_version": [
|
||||||
3,
|
3,
|
||||||
9,
|
9,
|
||||||
|
|
|
@ -21,7 +21,7 @@ class HotReload(commands.Cog):
|
||||||
|
|
||||||
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
|
||||||
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
|
||||||
__version__ = "1.4.1"
|
__version__ = "1.4.2"
|
||||||
__documentation__ = "https://seacogs.coastalcommits.com/hotreload/"
|
__documentation__ = "https://seacogs.coastalcommits.com/hotreload/"
|
||||||
|
|
||||||
def __init__(self, bot: Red) -> None:
|
def __init__(self, bot: Red) -> None:
|
||||||
|
@ -60,6 +60,7 @@ class HotReload(commands.Cog):
|
||||||
]
|
]
|
||||||
return "\n".join(text)
|
return "\n".join(text)
|
||||||
|
|
||||||
|
# pylint: disable=protected-access
|
||||||
async def get_paths(self) -> Generator[Path, None, None]:
|
async def get_paths(self) -> Generator[Path, None, None]:
|
||||||
"""Retrieve user defined paths."""
|
"""Retrieve user defined paths."""
|
||||||
cog_manager = self.bot._cog_mgr # noqa: SLF001 # We have to use this private method because there is no public API to get user defined paths
|
cog_manager = self.bot._cog_mgr # noqa: SLF001 # We have to use this private method because there is no public API to get user defined paths
|
||||||
|
@ -91,7 +92,6 @@ class HotReload(commands.Cog):
|
||||||
@commands.group(name="hotreload")
|
@commands.group(name="hotreload")
|
||||||
async def hotreload_group(self, ctx: commands.Context) -> None:
|
async def hotreload_group(self, ctx: commands.Context) -> None:
|
||||||
"""HotReload configuration commands."""
|
"""HotReload configuration commands."""
|
||||||
pass
|
|
||||||
|
|
||||||
@hotreload_group.command(name="notifychannel")
|
@hotreload_group.command(name="notifychannel")
|
||||||
async def hotreload_notifychannel(self, ctx: commands.Context, channel: discord.TextChannel) -> None:
|
async def hotreload_notifychannel(self, ctx: commands.Context, channel: discord.TextChannel) -> None:
|
||||||
|
@ -155,6 +155,7 @@ class HotReloadHandler(RegexMatchingEventHandler):
|
||||||
loop=self.cog.bot.loop,
|
loop=self.cog.bot.loop,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# pylint: disable=protected-access
|
||||||
async def reload_cogs(self, cog_names: Sequence[str], paths: Sequence[Path]) -> None:
|
async def reload_cogs(self, cog_names: Sequence[str], paths: Sequence[Path]) -> None:
|
||||||
"""Reload modified cogs."""
|
"""Reload modified cogs."""
|
||||||
if not self.compile_modified_files(cog_names, paths):
|
if not self.compile_modified_files(cog_names, paths):
|
||||||
|
|
|
@ -2,28 +2,29 @@ from redbot.core import Config
|
||||||
|
|
||||||
config: Config = Config.get_conf(None, identifier=457581387213637448123567, cog_name="Pterodactyl", force_registration=True)
|
config: Config = Config.get_conf(None, identifier=457581387213637448123567, cog_name="Pterodactyl", force_registration=True)
|
||||||
|
|
||||||
|
|
||||||
def register_config(config_obj: Config) -> None:
|
def register_config(config_obj: Config) -> None:
|
||||||
config_obj.register_global(
|
config_obj.register_global(
|
||||||
base_url=None,
|
base_url=None,
|
||||||
server_id=None,
|
server_id=None,
|
||||||
console_channel=None,
|
console_channel=None,
|
||||||
console_commands_enabled=False,
|
console_commands_enabled=False,
|
||||||
current_status='',
|
current_status="",
|
||||||
chat_regex=r"^\[\d{2}:\d{2}:\d{2}\sINFO\]: (?!\[(?:Server|Rcon)\])(?:<|\[)(\w+)(?:>|\]) (.*)",
|
chat_regex=r"^\[\d{2}:\d{2}:\d{2}\sINFO\]: (?!\[(?:Server|Rcon)\])(?:<|\[)(\w+)(?:>|\]) (.*)",
|
||||||
server_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]:(?: \[Not Secure\])? \[(?:Server|Rcon)\] (.*)",
|
server_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]:(?: \[Not Secure\])? \[(?:Server|Rcon)\] (.*)",
|
||||||
join_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: ([^<\n]+) joined the game$",
|
join_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: ([^<\n]+) joined the game$",
|
||||||
leave_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: ([^<\n]+) left the game$",
|
leave_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: ([^<\n]+) left the game$",
|
||||||
achievement_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: (.*) has (made the advancement|completed the challenge) \[(.*)\]$",
|
achievement_regex=r"^\[\d{2}:\d{2}:\d{2} INFO\]: (.*) has (made the advancement|completed the challenge) \[(.*)\]$",
|
||||||
chat_command='tellraw @a ["",{"text":".$N ","color":".$C","insertion":"<@.$I>","hoverEvent":{"action":"show_text","contents":"Shift click to mention this user inside Discord"}},{"text":"(DISCORD):","color":"blue","clickEvent":{"action":"open_url","value":".$V"},"hoverEvent":{"action":"show_text","contents":"Click to join the Discord Server"}},{"text":" .$M","color":"white"}]', # noqa: E501
|
chat_command='tellraw @a ["",{"text":".$N ","color":".$C","insertion":"<@.$I>","hoverEvent":{"action":"show_text","contents":"Shift click to mention this user inside Discord"}},{"text":"(DISCORD):","color":"blue","clickEvent":{"action":"open_url","value":".$V"},"hoverEvent":{"action":"show_text","contents":"Click to join the Discord Server"}},{"text":" .$M","color":"white"}]', # noqa: E501
|
||||||
topic='Server IP: .$H\nServer Players: .$P/.$M',
|
topic="Server IP: .$H\nServer Players: .$P/.$M",
|
||||||
topic_hostname=None,
|
topic_hostname=None,
|
||||||
topic_port=25565,
|
topic_port=25565,
|
||||||
api_endpoint="minecraft",
|
api_endpoint="minecraft",
|
||||||
chat_channel=None,
|
chat_channel=None,
|
||||||
startup_msg='Server started!',
|
startup_msg="Server started!",
|
||||||
shutdown_msg='Server stopped!',
|
shutdown_msg="Server stopped!",
|
||||||
join_msg='Welcome to the server! 👋',
|
join_msg="Welcome to the server! 👋",
|
||||||
leave_msg='Goodbye! 👋',
|
leave_msg="Goodbye! 👋",
|
||||||
mask_ip=True,
|
mask_ip=True,
|
||||||
invite=None,
|
invite=None,
|
||||||
regex_blacklist={},
|
regex_blacklist={},
|
||||||
|
|
Loading…
Add table
Reference in a new issue