fix(repo): update all instances of SeaswimmerTheFsh to cswimr

This commit is contained in:
cswimr 2024-08-27 14:25:14 -04:00
parent f3f99209da
commit 14fe976a0d
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
24 changed files with 150 additions and 322 deletions

View file

@ -10,7 +10,7 @@ Aurora is a fully-featured moderation system. It is heavily inspired by Galactic
## Installation
```bash
[p]repo add seacogs https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs aurora
[p]cog load aurora
```

View file

@ -5,14 +5,14 @@ Backup allows you to export a JSON list of all of your installed repositories an
## Installation
```bash
[p]repo add seacogs https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs backup
[p]cog load backup
```
## Version Compatibility
As of commit [1edb08a](https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs/commit/1edb08a1271f12098ca0bed11a735f7162cedd14), the Backup cog no longer supports Red versions older than 3.5.6. If you want to use the cog on an earlier version (3.5.0 - 3.5.5), install the cog pinned to this commit: `43464db6a7c51bc69282b1ae3dc507a4aae851de`.
As of commit [1edb08a](https://www.coastalcommits.com/cswimr/SeaCogs/commit/1edb08a1271f12098ca0bed11a735f7162cedd14), the Backup cog no longer supports Red versions older than 3.5.6. If you want to use the cog on an earlier version (3.5.0 - 3.5.5), install the cog pinned to this commit: `43464db6a7c51bc69282b1ae3dc507a4aae851de`.
```bash
[p]cog installversion sea-cogs 43464db6a7c51bc69282b1ae3dc507a4aae851de backup

View file

@ -6,7 +6,7 @@ This cog does require an api key to work.
## Installation
```bash
[p]repo add seacogs https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs bible
[p]cog load bible
```

View file

@ -5,7 +5,7 @@ EmojiInfo allows you to retrieve information about an emoji.
## Installation
```bash
[p]repo add seacogs https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs emojiinfo
[p]cog load emojiinfo
```

View file

@ -5,7 +5,7 @@ Nerdify allows you to nerdify other people's text.
## Installation
```bash
[p]repo add seacogs https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs nerdify
[p]cog load nerdify
```

View file

@ -28,7 +28,7 @@ The Downloader cog allows you to add Git repositories to your bot in order to do
Now, use Downloader to add my repository to your bot:
```
[p]repo add sea-cogs https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add sea-cogs https://www.coastalcommits.com/cswimr/SeaCogs
```
Now, install the Pterodactyl cog:

View file

@ -10,7 +10,7 @@ Pterodactyl allows for connecting to a Pterodactyl server through websockets. It
## Installation
```bash
[p]repo add seacogs https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add seacogs https://www.coastalcommits.com/cswimr/SeaCogs
[p]cog install seacogs pterodactyl
[p]cog load aurora
```

View file

@ -64,7 +64,7 @@ Red is quite a large bot, so I'll focus on the specifics of getting the bot work
```
2. Add my repository to the bot
```bash
[p]repo add sea-cogs https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs
[p]repo add sea-cogs https://www.coastalcommits.com/cswimr/SeaCogs
```
3. Install and load the Pterodactyl cog
```bash

View file

@ -13,7 +13,7 @@ body:
attributes:
label: Please confirm that;
options:
- label: I have checked that this bug does not already have an opened/closed [issue](https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs/issues) or [pull request](https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs/pulls) associated with it.
- label: I have checked that this bug does not already have an opened/closed [issue](https://www.coastalcommits.com/cswimr/SeaCogs/issues) or [pull request](https://www.coastalcommits.com/cswimr/SeaCogs/pulls) associated with it.
required: true
- label: I have checked that I am on the latest version of [Red-DiscordBot](https://github.com/CogCreators/Red-DiscordBot), and SeaCogs.
required: true

View file

@ -2,5 +2,5 @@
<!-- Create a new issue, if it doesn't exist yet -->
- [ ] By submitting this pull request, I permit SeaswimmerTheFsh to license my work under
the [Mozilla Public License Version 2.0](https://www.coastalcommits.com/SeaswimmerTheFsh/SeaCogs/src/branch/main/LICENSE).
- [ ] By submitting this pull request, I permit cswimr to license my work under
the [Mozilla Public License Version 2.0](https://www.coastalcommits.com/cswimr/SeaCogs/src/branch/main/LICENSE).

View file

@ -11,7 +11,7 @@ My assorted cogs for Red-DiscordBot.
To get started with a development environment, first clone this repository.
```sh
git clone https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs.git
git clone https://coastalcommits.com/cswimr/SeaCogs.git
```
Then, install Poetry.

View file

@ -1,6 +1,6 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing AntiPolls!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing AntiPolls!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "AntiPolls",
"short" : "AntiPolls deletes messages that contain polls.",
"description" : "AntiPolls deletes messages that contain polls, with a configurable per-guild role and channel whitelist and support for default Discord permissions (Manage Messages).",

View file

@ -70,9 +70,7 @@ class Aurora(commands.Cog):
if requester == "user_strict":
await config.user_from_id(user_id).clear()
else:
logger.warning(
"Invalid requester passed to red_delete_data_for_user: %s", requester
)
logger.warning("Invalid requester passed to red_delete_data_for_user: %s", requester)
def __init__(self, bot: Red) -> None:
super().__init__()
@ -85,7 +83,7 @@ class Aurora(commands.Cog):
# and the information that aiosqlite logs is not useful to the bot owner.
# This is a bad solution though as it overrides it for any other cogs that are using aiosqlite too.
# If there's a better solution that you're aware of, please let me know in Discord or in a CoastalCommits issue.
py_logging.getLogger('aiosqlite').setLevel(py_logging.INFO)
py_logging.getLogger("aiosqlite").setLevel(py_logging.INFO)
def format_help_for_context(self, ctx: commands.Context) -> str:
pre_processed = super().format_help_for_context(ctx) or ""
@ -140,13 +138,7 @@ class Aurora(commands.Cog):
if dm_users is None:
dm_users = await config.guild(ctx.guild).dm_users()
silent = not dm_users
return await moderation_type.handler(
ctx=ctx,
target=target,
silent=silent,
**kwargs
)
return await moderation_type.handler(ctx=ctx, target=target, silent=silent, **kwargs)
@commands.Cog.listener("on_guild_join")
async def db_generate_on_guild_join(self, guild: discord.Guild):
@ -189,27 +181,23 @@ class Aurora(commands.Cog):
reason = "This action was performed without the bot."
if entry.action == discord.AuditLogAction.kick:
moderation_type = type_registry['kick']
moderation_type = type_registry["kick"]
elif entry.action == discord.AuditLogAction.ban:
moderation_type = type_registry['ban']
moderation_type = type_registry["ban"]
elif entry.action == discord.AuditLogAction.unban:
moderation_type = type_registry['unban']
moderation_type = type_registry["unban"]
elif entry.action == discord.AuditLogAction.member_update:
if entry.after.timed_out_until is not None:
timed_out_until_aware = entry.after.timed_out_until.replace(
tzinfo=timezone.utc
)
duration_datetime = timed_out_until_aware - datetime.now(
tz=timezone.utc
)
timed_out_until_aware = entry.after.timed_out_until.replace(tzinfo=timezone.utc)
duration_datetime = timed_out_until_aware - datetime.now(tz=timezone.utc)
minutes = round(duration_datetime.total_seconds() / 60)
duration = timedelta(minutes=minutes)
moderation_type = type_registry['mute']
moderation_type = type_registry["mute"]
else:
moderation_type = type_registry['unmute']
moderation_type = type_registry["unmute"]
else:
return
@ -254,7 +242,7 @@ class Aurora(commands.Cog):
target=target,
silent=silent,
permissions=["moderate_members"],
moderation_type=type_registry['note'],
moderation_type=type_registry["note"],
reason=reason,
)
@ -281,7 +269,7 @@ class Aurora(commands.Cog):
target=target,
silent=silent,
permissions=["moderate_members"],
moderation_type=type_registry['warn'],
moderation_type=type_registry["warn"],
reason=reason,
)
@ -309,16 +297,7 @@ class Aurora(commands.Cog):
How long are you adding this role for?
silent: bool
Should the user be messaged?"""
await self.moderate(
ctx=interaction,
target=target,
silent=silent,
permissions=["moderate_members", "manage_roles"],
moderation_type=type_registry['addrole'],
reason=reason,
role=role,
duration=duration
)
await self.moderate(ctx=interaction, target=target, silent=silent, permissions=["moderate_members", "manage_roles"], moderation_type=type_registry["addrole"], reason=reason, role=role, duration=duration)
@app_commands.command(name="removerole")
async def removerole(
@ -344,16 +323,7 @@ class Aurora(commands.Cog):
How long are you removing this role for?
silent: bool
Should the user be messaged?"""
await self.moderate(
ctx=interaction,
target=target,
silent=silent,
permissions=["moderate_members", "manage_roles"],
moderation_type=type_registry['removerole'],
reason=reason,
role=role,
duration=duration
)
await self.moderate(ctx=interaction, target=target, silent=silent, permissions=["moderate_members", "manage_roles"], moderation_type=type_registry["removerole"], reason=reason, role=role, duration=duration)
@app_commands.command(name="mute")
async def mute(
@ -381,7 +351,7 @@ class Aurora(commands.Cog):
target=target,
silent=silent,
permissions=["moderate_members"],
moderation_type=type_registry['mute'],
moderation_type=type_registry["mute"],
duration=duration,
reason=reason,
)
@ -409,7 +379,7 @@ class Aurora(commands.Cog):
target=target,
silent=silent,
permissions=["moderate_members"],
moderation_type=type_registry['unmute'],
moderation_type=type_registry["unmute"],
reason=reason,
)
@ -436,7 +406,7 @@ class Aurora(commands.Cog):
target=target,
silent=silent,
permissions=["kick_members"],
moderation_type=type_registry['kick'],
moderation_type=type_registry["kick"],
reason=reason,
)
@ -480,7 +450,7 @@ class Aurora(commands.Cog):
target=target,
silent=silent,
permissions=["ban_members"],
moderation_type=type_registry['tempban'],
moderation_type=type_registry["tempban"],
reason=reason,
duration=duration,
delete_messages=delete_messages,
@ -491,7 +461,7 @@ class Aurora(commands.Cog):
target=target,
silent=silent,
permissions=["ban_members"],
moderation_type=type_registry['ban'],
moderation_type=type_registry["ban"],
reason=reason,
delete_messages=delete_messages,
)
@ -519,7 +489,7 @@ class Aurora(commands.Cog):
target=target,
silent=silent,
permissions=["ban_members"],
moderation_type=type_registry['unban'],
moderation_type=type_registry["unban"],
reason=reason,
)
@ -549,7 +519,7 @@ class Aurora(commands.Cog):
target=channel,
silent=True,
permissions=["manage_channel"],
moderation_type=type_registry['slowmode'],
moderation_type=type_registry["slowmode"],
interval=interval,
reason=reason,
)
@ -600,46 +570,26 @@ class Aurora(commands.Cog):
export: bool
Exports the server's moderation history to a JSON file"""
if ephemeral is None:
ephemeral = (
await config.user(interaction.user).history_ephemeral()
or await config.guild(interaction.guild).history_ephemeral()
or False
)
ephemeral = await config.user(interaction.user).history_ephemeral() or await config.guild(interaction.guild).history_ephemeral() or False
if inline is None:
inline = (
await config.user(interaction.user).history_inline()
or await config.guild(interaction.guild).history_inline()
or False
)
inline = await config.user(interaction.user).history_inline() or await config.guild(interaction.guild).history_inline() or False
if pagesize is None:
if inline is True:
pagesize = (
await config.user(interaction.user).history_inline_pagesize()
or await config.guild(interaction.guild).history_inline_pagesize()
or 6
)
pagesize = await config.user(interaction.user).history_inline_pagesize() or await config.guild(interaction.guild).history_inline_pagesize() or 6
else:
pagesize = (
await config.user(interaction.user).history_pagesize()
or await config.guild(interaction.guild).history_pagesize()
or 5
)
pagesize = await config.user(interaction.user).history_pagesize() or await config.guild(interaction.guild).history_pagesize() or 5
if before and not on:
try:
before = parse(before)
except (ParserError, OverflowError) as e:
if e == ParserError:
await interaction.response.send_message(
content=error("Invalid date format for `before` parameter!"), ephemeral=True
)
await interaction.response.send_message(content=error("Invalid date format for `before` parameter!"), ephemeral=True)
return
if e == OverflowError:
await interaction.response.send_message(
content=error("Date is too far in the future!"), ephemeral=True
)
await interaction.response.send_message(content=error("Date is too far in the future!"), ephemeral=True)
return
if after and not on:
@ -647,14 +597,10 @@ class Aurora(commands.Cog):
after = parse(after)
except (ParserError, OverflowError) as e:
if e == ParserError:
await interaction.response.send_message(
content=error("Invalid date format for `after` parameter!"), ephemeral=True
)
await interaction.response.send_message(content=error("Invalid date format for `after` parameter!"), ephemeral=True)
return
if e == OverflowError:
await interaction.response.send_message(
content=error("Date is too far in the future!"), ephemeral=True
)
await interaction.response.send_message(content=error("Date is too far in the future!"), ephemeral=True)
return
if on:
@ -662,14 +608,10 @@ class Aurora(commands.Cog):
on = parse(on)
except (ParserError, OverflowError) as e:
if e == ParserError:
await interaction.response.send_message(
content=error("Invalid date format for `on` parameter!"), ephemeral=True
)
await interaction.response.send_message(content=error("Invalid date format for `on` parameter!"), ephemeral=True)
return
if e == OverflowError:
await interaction.response.send_message(
content=error("Date is too far in the future!"), ephemeral=True
)
await interaction.response.send_message(content=error("Date is too far in the future!"), ephemeral=True)
return
before = datetime.combine(on, datetime.max.time())
@ -677,20 +619,16 @@ class Aurora(commands.Cog):
await interaction.response.defer(ephemeral=ephemeral)
permissions = check_permissions(
interaction.client.user, ["embed_links"], interaction
)
permissions = check_permissions(interaction.client.user, ["embed_links"], interaction)
if permissions:
await interaction.followup.send(
error(
f"I do not have the `{permissions}` permission, required for this action."
),
error(f"I do not have the `{permissions}` permission, required for this action."),
ephemeral=True,
)
return
if export and not types:
types = 'all'
types = "all"
type_list = []
registry_values = type_registry.values()
@ -722,29 +660,20 @@ class Aurora(commands.Cog):
if export:
try:
filepath = (
str(data_manager.cog_data_path(cog_instance=self))
+ str(os.sep)
+ filename
)
filepath = str(data_manager.cog_data_path(cog_instance=self)) + str(os.sep) + filename
with open(filepath, "w", encoding="utf-8") as f:
dump(obj=moderations, fp=f)
await interaction.followup.send(
file=discord.File(
fp=filepath, filename=filename
),
file=discord.File(fp=filepath, filename=filename),
ephemeral=ephemeral,
)
os.remove(filepath)
except json.JSONDecodeError as e:
await interaction.followup.send(
content=error(
"An error occurred while exporting the moderation history.\nError:\n"
)
+ box(text=e, lang="py"),
content=error("An error occurred while exporting the moderation history.\nError:\n") + box(text=e, lang="py"),
ephemeral=ephemeral,
)
return
@ -756,23 +685,17 @@ class Aurora(commands.Cog):
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_footer(
text=f"Page {page:,}/{page_quantity:,} | {case_quantity:,} Results"
)
embed.set_footer(text=f"Page {page:,}/{page_quantity:,} | {case_quantity:,} Results")
memory_dict = {}
for mod in moderations[start_index:end_index]:
if mod.target_id not in memory_dict:
memory_dict.update({
str(mod.target_id): await mod.get_target()
})
memory_dict.update({str(mod.target_id): await mod.get_target()})
target = memory_dict[str(mod.target_id)]
if mod.moderator_id not in memory_dict:
memory_dict.update({
str(mod.moderator_id): await mod.get_moderator()
})
memory_dict.update({str(mod.moderator_id): await mod.get_moderator()})
moderator = memory_dict[str(mod.moderator_id)]
field_name = f"Case #{mod.id:,} ({mod.type.string.title()})"
@ -784,16 +707,10 @@ class Aurora(commands.Cog):
field_value += f"\n**Reason:** `{str(mod.reason)}`"
if mod.duration:
duration_embed = (
f"{humanize_timedelta(timedelta=mod.duration)} | <t:{int(mod.end_timestamp.timestamp())}:R>"
if mod.expired is False
else f"{humanize_timedelta(timedelta=mod.duration)} | Expired"
)
duration_embed = f"{humanize_timedelta(timedelta=mod.duration)} | <t:{int(mod.end_timestamp.timestamp())}:R>" if mod.expired is False else f"{humanize_timedelta(timedelta=mod.duration)} | Expired"
field_value += f"\n**Duration:** {duration_embed}"
field_value += (
f"\n**Timestamp:** <t:{int(mod.timestamp.timestamp())}> | <t:{int(mod.timestamp.timestamp())}:R>"
)
field_value += f"\n**Timestamp:** <t:{int(mod.timestamp.timestamp())}> | <t:{int(mod.timestamp.timestamp())}:R>"
if mod.role_id:
role = await mod.get_role()
@ -806,8 +723,8 @@ class Aurora(commands.Cog):
await interaction.followup.send(embed=embed, ephemeral=ephemeral)
@history.autocomplete('types')
async def _history_types(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]: # pylint: disable=unused-argument
@history.autocomplete("types")
async def _history_types(self, interaction: discord.Interaction, current: str) -> List[app_commands.Choice[str]]: # pylint: disable=unused-argument
types: List[str] = sorted(self.type_registry.keys())
choices = []
if current.endswith(","):
@ -815,7 +732,7 @@ class Aurora(commands.Cog):
if c in types:
types.remove(c)
for t in types:
choices.append(app_commands.Choice(name=current+t, value=current+t))
choices.append(app_commands.Choice(name=current + t, value=current + t))
else:
choices.append(app_commands.Choice(name="all", value="all"))
for t in types:
@ -824,9 +741,7 @@ class Aurora(commands.Cog):
return choices[:25]
@app_commands.command(name="resolve")
async def resolve(
self, interaction: discord.Interaction, case: int, reason: str = "No reason provided."
):
async def resolve(self, interaction: discord.Interaction, case: int, reason: str = "No reason provided."):
"""Resolve a specific case.
Parameters
@ -842,9 +757,7 @@ class Aurora(commands.Cog):
)
if permissions:
await interaction.response.send_message(
error(
f"I do not have the `{permissions}` permission, required for this action."
),
error(f"I do not have the `{permissions}` permission, required for this action."),
ephemeral=True,
)
return
@ -852,15 +765,11 @@ class Aurora(commands.Cog):
try:
moderation = await Moderation.find_by_id(interaction.client, case, interaction.guild.id)
except ValueError:
await interaction.response.send_message(
content=error(f"Case #{case:,} does not exist!"), ephemeral=True
)
await interaction.response.send_message(content=error(f"Case #{case:,} does not exist!"), ephemeral=True)
return
if len(moderation.changes) > 25:
await interaction.response.send_message(
content=error(
"Due to limitations with Discord's embed system, you cannot edit a case more than 25 times."
),
content=error("Due to limitations with Discord's embed system, you cannot edit a case more than 25 times."),
ephemeral=True,
)
return
@ -869,21 +778,15 @@ class Aurora(commands.Cog):
success, msg = await moderation.resolve(interaction.user.id, reason)
except (ValueError, TypeError) as e:
if e == ValueError:
await interaction.response.send_message(
content=error("This case has already been resolved!"), ephemeral=True
)
await interaction.response.send_message(content=error("This case has already been resolved!"), ephemeral=True)
elif e == TypeError:
await interaction.response.send_message(
content=error("This case type cannot be resolved!"), ephemeral=True
)
await interaction.response.send_message(content=error("This case type cannot be resolved!"), ephemeral=True)
embed = await case_factory(
interaction=interaction,
moderation=moderation,
)
await interaction.response.send_message(
content=f"✅ Moderation #{case:,} resolved!\n" + error(f"Resolve handler returned an error message: `{msg}`") if success is False else "", embed=embed
)
await interaction.response.send_message(content=f"✅ Moderation #{case:,} resolved!\n" + error(f"Resolve handler returned an error message: `{msg}`") if success is False else "", embed=embed)
ctx = await self.bot.get_context(interaction, cls=commands.Context)
await log(ctx=ctx, moderation_id=case, resolved=True)
@ -917,47 +820,31 @@ class Aurora(commands.Cog):
List the changes made to the case
raw: bool
Export the case to a JSON file or codeblock"""
permissions = check_permissions(
interaction.client.user, ["embed_links"], interaction
)
permissions = check_permissions(interaction.client.user, ["embed_links"], interaction)
if permissions:
await interaction.response.send_message(
error(
f"I do not have the `{permissions}` permission, required for this action."
),
error(f"I do not have the `{permissions}` permission, required for this action."),
ephemeral=True,
)
return
if ephemeral is None:
ephemeral = (
await config.user(interaction.user).history_ephemeral()
or await config.guild(interaction.guild).history_ephemeral()
or False
)
ephemeral = await config.user(interaction.user).history_ephemeral() or await config.guild(interaction.guild).history_ephemeral() or False
try:
mod = await Moderation.find_by_id(interaction.client, case, interaction.guild.id)
except ValueError:
await interaction.response.send_message(
content=error(f"Case #{case:,} does not exist!"), ephemeral=True
)
await interaction.response.send_message(content=error(f"Case #{case:,} does not exist!"), ephemeral=True)
return
if raw:
if raw.value == "file" or len(mod.to_json(2)) > 1800:
filename = (
str(data_manager.cog_data_path(cog_instance=self))
+ str(os.sep)
+ f"moderation_{interaction.guild.id}_case_{case}.json"
)
filename = 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:
mod.to_json(2, f)
if raw.value == "codeblock":
content = f"Case #{case:,} exported.\n" + warning(
"Case was too large to export as codeblock, so it has been uploaded as a `.json` file."
)
content = f"Case #{case:,} exported.\n" + warning("Case was too large to export as codeblock, so it has been uploaded as a `.json` file.")
else:
content = f"Case #{case:,} exported."
@ -973,29 +860,19 @@ class Aurora(commands.Cog):
os.remove(filename)
return
await interaction.response.send_message(
content=box(mod.to_json(2), 'json'),
content=box(mod.to_json(2), "json"),
ephemeral=ephemeral,
)
return
if changes:
embed = await changes_factory(
interaction=interaction, moderation=mod
)
await interaction.response.send_message(
embed=embed, ephemeral=ephemeral
)
embed = await changes_factory(interaction=interaction, moderation=mod)
await interaction.response.send_message(embed=embed, ephemeral=ephemeral)
elif evidenceformat:
content = await evidenceformat_factory(moderation=mod)
await interaction.response.send_message(
content=content, ephemeral=ephemeral
)
await interaction.response.send_message(content=content, ephemeral=ephemeral)
else:
embed = await case_factory(
interaction=interaction, moderation=mod
)
await interaction.response.send_message(
embed=embed, ephemeral=ephemeral
)
embed = await case_factory(interaction=interaction, moderation=mod)
await interaction.response.send_message(embed=embed, ephemeral=ephemeral)
return
@app_commands.command(name="edit")
@ -1017,14 +894,10 @@ class Aurora(commands.Cog):
duration: str
What is the new duration? Does not reapply the moderation if it has already expired.
"""
permissions = check_permissions(
interaction.client.user, ["embed_links"], interaction
)
permissions = check_permissions(interaction.client.user, ["embed_links"], interaction)
if permissions:
await interaction.response.send_message(
error(
f"I do not have the `{permissions}` permission, required for this action."
),
error(f"I do not have the `{permissions}` permission, required for this action."),
ephemeral=True,
)
return
@ -1033,16 +906,12 @@ class Aurora(commands.Cog):
moderation = await Moderation.find_by_id(interaction.client, case, interaction.guild.id)
old_moderation = moderation.model_copy()
except ValueError:
await interaction.response.send_message(
content=error(f"Case #{case:,} does not exist!"), ephemeral=True
)
await interaction.response.send_message(content=error(f"Case #{case:,} does not exist!"), ephemeral=True)
return
if len(moderation.changes) > 25:
return await interaction.response.send_message(
content=error(
"Due to limitations with Discord's embed system, you cannot edit a case more than 25 times."
),
content=error("Due to limitations with Discord's embed system, you cannot edit a case more than 25 times."),
ephemeral=True,
)
@ -1053,18 +922,14 @@ class Aurora(commands.Cog):
raise commands.BadArgument()
moderation.duration = timedelta_from_relativedelta(relativedelta=parsed_time)
except (commands.BadArgument, ValueError):
return await interaction.response.send_message(
error("Please provide a valid duration!"), ephemeral=True
)
return await interaction.response.send_message(error("Please provide a valid duration!"), ephemeral=True)
moderation.end_timestamp = moderation.timestamp + timedelta(seconds=moderation.duration.total_seconds())
try:
success = await moderation.type.duration_edit_handler(interaction=interaction, old_moderation=old_moderation, new_moderation=moderation)
except NotImplementedError:
return await interaction.response.send_message(
error("This case type does not support duration editing!"), ephemeral=True
)
return await interaction.response.send_message(error("This case type does not support duration editing!"), ephemeral=True)
if not success:
return
@ -1072,27 +937,35 @@ class Aurora(commands.Cog):
moderation.reason = reason
if not reason and not duration:
return await interaction.response.send_message(
error("Please provide a new reason or duration to edit this case!"), ephemeral=True
)
return await interaction.response.send_message(error("Please provide a new reason or duration to edit this case!"), ephemeral=True)
if not moderation.changes:
moderation.changes.append(Change.from_dict(interaction.client, {
"type": "ORIGINAL",
"timestamp": old_moderation.timestamp,
"reason": old_moderation.reason,
"user_id": old_moderation.moderator_id,
"duration": timedelta_to_string(old_moderation.duration) if old_moderation.duration else None,
"end_timestamp": old_moderation.end_timestamp,
}))
moderation.changes.append(Change.from_dict(interaction.client, {
"type": "EDIT",
"timestamp": int(time.time()),
"reason": reason if reason else None,
"user_id": interaction.user.id,
"duration": timedelta_to_string(moderation.duration) if duration else None,
"end_timestamp": moderation.end_timestamp if duration else None,
}))
moderation.changes.append(
Change.from_dict(
interaction.client,
{
"type": "ORIGINAL",
"timestamp": old_moderation.timestamp,
"reason": old_moderation.reason,
"user_id": old_moderation.moderator_id,
"duration": timedelta_to_string(old_moderation.duration) if old_moderation.duration else None,
"end_timestamp": old_moderation.end_timestamp,
},
)
)
moderation.changes.append(
Change.from_dict(
interaction.client,
{
"type": "EDIT",
"timestamp": int(time.time()),
"reason": reason if reason else None,
"user_id": interaction.user.id,
"duration": timedelta_to_string(moderation.duration) if duration else None,
"end_timestamp": moderation.end_timestamp if duration else None,
},
)
)
await moderation.update()
embed = await case_factory(interaction=interaction, moderation=moderation)
@ -1135,7 +1008,7 @@ class Aurora(commands.Cog):
except NotImplementedError:
logger.warning("Expiry handler not implemented for expirable moderation type %s", moderation.type.key)
continue
except Exception as e: # pylint: disable=broad-except
except Exception as e: # pylint: disable=broad-except
logger.exception("Expiry handler failed for moderation %s with the type %s", moderation.id, moderation.type.key, exc_info=e)
error_num += 1
continue
@ -1153,34 +1026,15 @@ class Aurora(commands.Cog):
await Moderation.execute(bot=self.bot, guild_id=guild.id, query=expiry_query, parameters=(time.time(),), return_obj=False)
per_guild_completion_time = (time.time() - time_per_guild) * 1000
logger.debug(
"Completed expiry loop for %s (%s) in %sms with %s errors, %s users unbanned, %s roles added, and %s roles removed (%s other cases expired)",
guild.name,
guild.id,
f"{per_guild_completion_time:.6f}",
error_num,
unban_num,
addrole_num,
removerole_num,
other_num
)
logger.debug("Completed expiry loop for %s (%s) in %sms with %s errors, %s users unbanned, %s roles added, and %s roles removed (%s other cases expired)", guild.name, guild.id, f"{per_guild_completion_time:.6f}", error_num, unban_num, addrole_num, removerole_num, other_num)
global_unban_num = global_unban_num + unban_num
global_addrole_num = global_addrole_num + addrole_num
global_removerole_num = global_removerole_num + removerole_num
global_other_num = global_other_num + other_num
global_err_num = global_err_num + error_num
completion_time = (time.time() - current_time) * 1000
logger.debug(
"Completed expiry loop in %sms with %s errors, %s users unbanned, %s roles added, and %s roles removed (%s other cases expired)",
f"{completion_time:.6f}",
global_err_num,
global_unban_num,
global_addrole_num,
global_removerole_num,
global_other_num
)
logger.debug("Completed expiry loop in %sms with %s errors, %s users unbanned, %s roles added, and %s roles removed (%s other cases expired)", f"{completion_time:.6f}", global_err_num, global_unban_num, global_addrole_num, global_removerole_num, global_other_num)
########################################################################################################################
### Configuration Commands #
@ -1252,18 +1106,10 @@ class Aurora(commands.Cog):
@commands.admin()
async def aurora_import_aurora(self, ctx: commands.Context):
"""Import moderation history from another bot using Aurora."""
if (
ctx.message.attachments
and ctx.message.attachments[0].content_type
== "application/json; charset=utf-8"
):
if ctx.message.attachments and ctx.message.attachments[0].content_type == "application/json; charset=utf-8":
file = await ctx.message.attachments[0].read()
data: list[dict] = sorted(json.loads(file), key=lambda x: x["moderation_id"])
message = await ctx.send(
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.*"
)
)
message = await ctx.send(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.*"))
await message.edit(view=ImportAuroraView(60, ctx, message, data))
else:
await ctx.send(error("Please provide a valid Aurora export file."))
@ -1272,21 +1118,11 @@ class Aurora(commands.Cog):
@commands.admin()
async def aurora_import_galacticbot(self, ctx: commands.Context):
"""Import moderation history from GalacticBot."""
if (
ctx.message.attachments
and ctx.message.attachments[0].content_type
== "application/json; charset=utf-8"
):
message = await ctx.send(
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.*"
)
)
if ctx.message.attachments and ctx.message.attachments[0].content_type == "application/json; charset=utf-8":
message = await ctx.send(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.*"))
await message.edit(view=ImportGalacticBotView(60, ctx, message))
else:
await ctx.send(
error("Please provide a valid GalacticBot moderation export file.")
)
await ctx.send(error("Please provide a valid GalacticBot moderation export file."))
@aurora.group(autohelp=True, name="convert")
async def aurora_convert(self, ctx: commands.Context):
@ -1353,14 +1189,8 @@ class Aurora(commands.Cog):
timestamp=datetime.now(),
)
embed.set_thumbnail(url=self.bot.user.avatar.url)
embed.add_field(
name="Version",
value=f"[{self.__version__}]({self.__git__})"
)
embed.add_field(
name="Author",
value=', '.join(self.__author__)
)
embed.add_field(name="Version", value=f"[{self.__version__}]({self.__git__})")
embed.add_field(name="Author", value=", ".join(self.__author__))
if ctx.author.id in self.bot.owner_ids:
results = await Moderation.execute(query="SELECT name FROM sqlite_master WHERE type='table';", return_obj=False)
tables = [table[0] for table in results]
@ -1378,9 +1208,5 @@ class Aurora(commands.Cog):
name="Database Stats",
value=f"{bold('Table Count:')} {table_count:,}\n{bold('Row Count:')} {row_count:,}\n{bold('File Size:')} {filesize:,.0f} KB",
)
embed.add_field(
name="Moderation Types",
value=f"{len(type_registry)} registered types\n{box(', '.join(type_registry.keys()))}",
inline=False
)
embed.add_field(name="Moderation Types", value=f"{len(type_registry)} registered types\n{box(', '.join(type_registry.keys()))}", inline=False)
await ctx.send(embed=embed)

View file

@ -1,6 +1,6 @@
{
"author" : ["Seaswimmer (cswimr)"],
"install_msg" : "Thank you for installing Aurora!\nMost of this cog's functionality requires enabling slash commands.\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Aurora!\nMost of this cog's functionality requires enabling slash commands.\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "Aurora",
"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.",

View file

@ -197,7 +197,7 @@ class Backup(commands.Cog):
cog_modules = []
for cog in cogs:
# If you're forking this cog, make sure to change these strings!
if cog["name"] == "backup" and "SeaswimmerTheFsh/SeaCogs" in url:
if cog["name"] == "backup" and "cswimr/SeaCogs" in url:
continue
try:
cog_module = await InstalledCog.convert(ctx, cog["name"])
@ -233,7 +233,7 @@ class Backup(commands.Cog):
commit = None
# If you're forking this cog, make sure to change these strings!
if cog_name == "backup" and "SeaswimmerTheFsh/SeaCogs" in url:
if cog_name == "backup" and "cswimr/SeaCogs" in url:
continue
async with repository.checkout(

View file

@ -1,6 +1,6 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing Backup!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Backup!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "Backup",
"short" : "A utility to make reinstalling repositories and cogs after migrating the bot far easier.",
"description" : "A utility to make reinstalling repositories and cogs after migrating the bot far easier.",

View file

@ -1,6 +1,6 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing Bible!\nThis cog requires setting an API key for API.Bible. Please read the [documentation](https://seacogs.coastalcommits.com/bible/#setup) for more information.\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Bible!\nThis cog requires setting an API key for API.Bible. Please read the [documentation](https://seacogs.coastalcommits.com/bible/#setup) for more information.\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "Bible",
"short" : "Retrieve Bible verses from API.Bible.",
"description" : "Retrieve Bible verses from the API.Bible API. This cog requires an API.Bible api key.",

View file

@ -1,5 +1,5 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Emoji!",
"name" : "Emoji",
"short" : "Retrieve information about emojis.",

View file

@ -1,9 +1,9 @@
{
"author": [
"SeaswimmerTheFsh (seasw.)"
"cswimr"
],
"install_msg": "Thanks for installing my repo!\n\nIf you have any issues with any of the cogs, please create an issue [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs/issues) or join my [Discord Server](https://discord.gg/eMUMe77Yb8 ).",
"install_msg": "Thanks for installing my repo!\n\nIf you have any issues with any of the cogs, please create an issue [here](https://coastalcommits.com/cswimr/SeaCogs/issues) or join my [Discord Server](https://discord.gg/eMUMe77Yb8 ).",
"index_name": "sea-cogs",
"short": "Various cogs for Red, by SeaswimmerTheFsh (seasw.)",
"description": "Various cogs for Red, by SeaswimmerTheFsh (seasw.)"
"short": "Various cogs for Red, by cswimr",
"description": "Various cogs for Red, by cswimr"
}

View file

@ -1,12 +1,12 @@
site_name: SeaCogs Documentation
site_url: !ENV [SITE_URL, 'https://seacogs.coastalcommits.com']
repo_name: CoastalCommits
repo_url: https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs
repo_url: https://coastalcommits.com/cswimr/SeaCogs
edit_uri: !ENV [EDIT_URI, 'src/branch/main/.docs']
copyright: Copyright &copy; 2023-2024, SeaswimmerTheFsh
copyright: Copyright &copy; 2023-2024, cswimr
docs_dir: .docs
site_author: SeaswimmerTheFsh
site_author: cswimr
site_description: Documentation for my Red-DiscordBot Cogs.
nav:
@ -30,7 +30,7 @@ nav:
plugins:
- git-authors
- search
#- social
- social
- git-revision-date-localized:
enable_creation_date: true
type: timeago
@ -113,3 +113,5 @@ watch:
- ./bible
- ./nerdify
- ./pterodactyl
- ./emojiinfo
- ./antipolls

View file

@ -1,6 +1,6 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing Nerdify!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs). Based off of PhasecoreX's [UwU](<https://github.com/PhasecoreX/PCXCogs/tree/master/uwu>) cog.",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Nerdify!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs). Based off of PhasecoreX's [UwU](<https://github.com/PhasecoreX/PCXCogs/tree/master/uwu>) cog.",
"name" : "Nerdify",
"short" : "Nerdify your text!",
"description" : "Nerdify your text!",

View file

@ -1,6 +1,6 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing Pterodactyl!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).\nDocumentation can be found [here](https://seacogs.coastalcommits.com/pterodactyl ).",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing Pterodactyl!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).\nDocumentation can be found [here](https://seacogs.coastalcommits.com/pterodactyl ).",
"name" : "Pterodactyl",
"short" : "Interface with Pterodactyl through websockets.",
"description" : "Interface with Pterodactyl through websockets.",
@ -9,7 +9,7 @@
"disabled": false,
"min_bot_version": "3.5.0",
"min_python_version": [3, 8, 0],
"requirements": ["git+https://github.com/SeaswimmerTheFsh/pydactyl", "websockets"],
"requirements": ["git+https://github.com/cswimr/pydactyl", "websockets"],
"tags": [
"pterodactyl",
"minecraft",

View file

@ -2,7 +2,7 @@
name = "seacogs"
version = "0.1.0"
description = "My assorted cogs for Red-DiscordBot."
authors = ["SeaswimmerTheFsh"]
authors = ["cswimr"]
license = "MPL 2"
readme = "README.md"
package-mode = false

View file

@ -1,6 +1,6 @@
{
"author" : ["SeaswimmerTheFsh (seasw.)"],
"install_msg" : "Thank you for installing SeaUtils!\nYou can find the source code of this cog [here](https://coastalcommits.com/SeaswimmerTheFsh/SeaCogs).",
"author" : ["cswimr"],
"install_msg" : "Thank you for installing SeaUtils!\nYou can find the source code of this cog [here](https://coastalcommits.com/cswimr/SeaCogs).",
"name" : "SeaUtils",
"short" : "A collection of useful utilities.",
"description" : "A collection of useful utilities.",