forked from blizzthewolf/SeaCogs
fix(aurora): remove humanize
This commit is contained in:
parent
ba7a5f9208
commit
99dddf2fa7
4 changed files with 11 additions and 28 deletions
|
@ -13,13 +13,12 @@ from datetime import datetime, timedelta, timezone
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
import humanize
|
|
||||||
from discord.ext import tasks
|
from discord.ext import tasks
|
||||||
from redbot.core import app_commands, commands, data_manager
|
from redbot.core import app_commands, commands, data_manager
|
||||||
from redbot.core.app_commands import Choice
|
from redbot.core.app_commands import Choice
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.commands.converter import parse_relativedelta, parse_timedelta
|
from redbot.core.commands.converter import parse_relativedelta, parse_timedelta
|
||||||
from redbot.core.utils.chat_formatting import box, error, humanize_list, warning
|
from redbot.core.utils.chat_formatting import box, error, humanize_list, humanize_timedelta, warning
|
||||||
|
|
||||||
from aurora.importers.aurora import ImportAuroraView
|
from aurora.importers.aurora import ImportAuroraView
|
||||||
from aurora.importers.galacticbot import ImportGalacticBotView
|
from aurora.importers.galacticbot import ImportGalacticBotView
|
||||||
|
@ -371,10 +370,10 @@ class Aurora(commands.Cog):
|
||||||
|
|
||||||
await target.add_roles(
|
await target.add_roles(
|
||||||
role,
|
role,
|
||||||
reason=f"Role added by {interaction.user.id}{(' for ' + {humanize.precisedelta(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.precisedelta(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(
|
||||||
|
@ -388,7 +387,7 @@ class Aurora(commands.Cog):
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await response.edit(
|
await response.edit(
|
||||||
content=f"{target.mention} has been given the {role.mention} role{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')}! (Case `#{moderation_id:,}`)\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 '')}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`",
|
||||||
)
|
)
|
||||||
await log(interaction, moderation_id)
|
await log(interaction, moderation_id)
|
||||||
|
|
||||||
|
@ -445,7 +444,7 @@ class Aurora(commands.Cog):
|
||||||
)
|
)
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been muted for {humanize.precisedelta(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:
|
||||||
|
@ -476,7 +475,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.precisedelta(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)
|
||||||
|
|
||||||
|
@ -686,7 +685,7 @@ class Aurora(commands.Cog):
|
||||||
return
|
return
|
||||||
|
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
content=f"{target.mention} has been banned for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been banned for {humanize_timedelta(timedelta=parsed_time)}!\n**Reason** - `{reason}`"
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -720,7 +719,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.precisedelta(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)
|
||||||
|
|
||||||
|
@ -1060,9 +1059,9 @@ class Aurora(commands.Cog):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
duration_embed = (
|
duration_embed = (
|
||||||
f"{humanize.precisedelta(td)} | <t:{case['end_timestamp']}:R>"
|
f"{humanize_timedelta(timedelta=td)} | <t:{case['end_timestamp']}:R>"
|
||||||
if bool(case["expired"]) is False
|
if bool(case["expired"]) is False
|
||||||
else f"{humanize.precisedelta(td)} | Expired"
|
else f"{humanize_timedelta(timedelta=td)} | Expired"
|
||||||
)
|
)
|
||||||
field_value += f"\n**Duration:** {duration_embed}"
|
field_value += f"\n**Duration:** {duration_embed}"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
"short" : "A full replacement for Red's core Mod cogs.",
|
"short" : "A full replacement for Red's core Mod cogs.",
|
||||||
"description" : "Aurora is a fully-featured moderation system. It is heavily inspired by GalacticBot, and is designed to be a more user-friendly alternative to Red's core Mod cogs. This cog stores all of its data in an SQLite database.",
|
"description" : "Aurora is a fully-featured moderation system. It is heavily inspired by GalacticBot, and is designed to be a more user-friendly alternative to Red's core Mod cogs. This cog stores all of its data in an SQLite database.",
|
||||||
"end_user_data_statement" : "This cog stores the following information:\n- User IDs of accounts who moderate users or are moderated\n- Guild IDs of guilds with the cog enabled\n- Timestamps of moderations\n- Other information relating to moderations",
|
"end_user_data_statement" : "This cog stores the following information:\n- User IDs of accounts who moderate users or are moderated\n- Guild IDs of guilds with the cog enabled\n- Timestamps of moderations\n- Other information relating to moderations",
|
||||||
"requirements": ["humanize"],
|
|
||||||
"hidden": false,
|
"hidden": false,
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
"min_bot_version": "3.5.0",
|
"min_bot_version": "3.5.0",
|
||||||
|
|
16
poetry.lock
generated
16
poetry.lock
generated
|
@ -810,20 +810,6 @@ files = [
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
colorama = ">=0.4"
|
colorama = ">=0.4"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "humanize"
|
|
||||||
version = "4.9.0"
|
|
||||||
description = "Python humanize utilities"
|
|
||||||
optional = false
|
|
||||||
python-versions = ">=3.8"
|
|
||||||
files = [
|
|
||||||
{file = "humanize-4.9.0-py3-none-any.whl", hash = "sha256:ce284a76d5b1377fd8836733b983bfb0b76f1aa1c090de2566fcf008d7f6ab16"},
|
|
||||||
{file = "humanize-4.9.0.tar.gz", hash = "sha256:582a265c931c683a7e9b8ed9559089dea7edcf6cc95be39a3cbc2c5d5ac2bcfa"},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.extras]
|
|
||||||
tests = ["freezegun", "pytest", "pytest-cov"]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "idna"
|
name = "idna"
|
||||||
version = "3.4"
|
version = "3.4"
|
||||||
|
@ -2522,4 +2508,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = ">=3.11,<3.12"
|
python-versions = ">=3.11,<3.12"
|
||||||
content-hash = "b10a8c8d11a74351402e4663ba61655905a1939aa72701f9905c8a63bfd8f1ed"
|
content-hash = "29cb1f8ef1ae38b7eddac2db3838a9576727b0d37c5bfc93d7aa51e582ab28ed"
|
||||||
|
|
|
@ -9,7 +9,6 @@ readme = "README.md"
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = ">=3.11,<3.12"
|
python = ">=3.11,<3.12"
|
||||||
Red-DiscordBot = "^3.5.5"
|
Red-DiscordBot = "^3.5.5"
|
||||||
humanize = "^4.8.0"
|
|
||||||
py-dactyl = "^2.0.4"
|
py-dactyl = "^2.0.4"
|
||||||
websockets = "^12.0"
|
websockets = "^12.0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue