Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit e281835

Browse files
committed
refactor: remove unnecessary try-finally
1 parent d7b61af commit e281835

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

bot.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,9 @@ async def wait_for_stop_sign(message: discord.Message, *, replace_with: str):
8080
def check(reaction, user):
8181
return reaction.message.id == message.id and str(reaction.emoji) == "🛑"
8282

83-
try:
84-
await bot.wait_for("reaction_add", check=check)
85-
finally:
86-
logger.info(f"replacing message with: {replace_with}")
87-
await message.edit(content=replace_with)
83+
await bot.wait_for("reaction_add", check=check)
84+
logger.info(f"replacing message with: {replace_with}")
85+
await message.edit(content=replace_with)
8886

8987

9088
# -----------------------------------------------------------------------------

lib/meetings/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ def _signature(s: str, *, secret: str) -> str:
3939
return base64.urlsafe_b64encode(dig).decode()
4040

4141

42-
def _slug_with_signature(s: str, *, secret: str):
42+
def _slug_with_signature(s: str, *, secret: str, slug_length=16):
4343
slug = slugify(s)
44-
return "-".join((slug, _signature(slug, secret=secret)[:16]))
44+
return "-".join((slug, _signature(slug, secret=secret)[:slug_length]))
4545

4646

4747
def _pretty_uuid() -> str:
48-
return base64.urlsafe_b64encode(uuid.uuid4().bytes).decode().replace("=", "")
48+
return base64.urlsafe_b64encode(uuid.uuid4().bytes).decode().rstrip("=")
4949

5050

5151
def create_jitsi_meet(name: str = None, *, secret: str = None) -> str:

0 commit comments

Comments
 (0)