Skip to content

Commit

Permalink
Refactor code in deepl.py, detect_code.py, moderation.py, and tips.py
Browse files Browse the repository at this point in the history
  • Loading branch information
danparizher committed Mar 10, 2024
1 parent e48adec commit 6e8ab8a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cogs/deepl.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ async def translate(

embed = EmbedBuilder(
title=f"Original Text - {source_language or 'Auto Detect'}",
description=f"{text}",
description=text,
).build()

await ctx.respond(embed=embed)

embed = EmbedBuilder(
title=f"Translated Text - {target_language}",
description=f"{translated_text}",
description=translated_text,
).build()

await ctx.send(embed=embed)
Expand Down
3 changes: 1 addition & 2 deletions cogs/detect_code.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from __future__ import annotations

import re

import asyncio
import re
from contextlib import suppress
from itertools import islice
from os import getenv
Expand Down
7 changes: 1 addition & 6 deletions cogs/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,7 @@ def filter_content(content: str) -> str | None:
# remove all punctuation and spacing
content = content.translate(
str.maketrans(
{
unwanted_character: ""
for unwanted_character in (
string.whitespace + string.punctuation + string.digits
)
},
dict.fromkeys(string.whitespace + string.punctuation + string.digits, ""),
),
)

Expand Down
2 changes: 1 addition & 1 deletion cogs/tips.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __init__(self, bot: commands.Bot) -> None:
)
@limit(3)
async def tip(
self: Tips, # noqa
self: Tips,
ctx: ApplicationContext,
tip: str,
ping: Member | None = None,
Expand Down

0 comments on commit 6e8ab8a

Please sign in to comment.