Refactor Dockerfile to remove platform specification and clean up main.py by consolidating user permission checks
This commit is contained in:
parent
96695c0bee
commit
489d8980c8
2 changed files with 4 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
# check=error=true;experimental=all
|
||||
FROM --platform=$BUILDPLATFORM ghcr.io/astral-sh/uv:python3.13-bookworm-slim@sha256:73c021c3fe7264924877039e8a449ad3bb380ec89214282301affa9b2f863c5d
|
||||
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim@sha256:73c021c3fe7264924877039e8a449ad3bb380ec89214282301affa9b2f863c5d
|
||||
|
||||
# Change the working directory to the `app` directory
|
||||
WORKDIR /app
|
||||
|
|
|
|||
8
main.py
8
main.py
|
|
@ -66,7 +66,6 @@ class LoviBotClient(discord.Client):
|
|||
# Only allow certain users to interact with the bot
|
||||
allowed_users: list[str] = get_allowed_users()
|
||||
if message.author.name not in allowed_users:
|
||||
logger.info("Ignoring message from: %s", message.author.name)
|
||||
return
|
||||
|
||||
incoming_message: str | None = message.content
|
||||
|
|
@ -175,15 +174,14 @@ async def ask(interaction: discord.Interaction, text: str) -> None:
|
|||
await interaction.followup.send("You need to provide a question or message.", ephemeral=True)
|
||||
return
|
||||
|
||||
# Only allow certain users to interact with the bot
|
||||
allowed_users: list[str] = get_allowed_users()
|
||||
|
||||
user_name_lowercase: str = interaction.user.name.lower()
|
||||
logger.info("Received command from: %s", user_name_lowercase)
|
||||
|
||||
# Only allow certain users to interact with the bot
|
||||
allowed_users: list[str] = get_allowed_users()
|
||||
if user_name_lowercase not in allowed_users:
|
||||
logger.info("Ignoring message from: %s", user_name_lowercase)
|
||||
await interaction.followup.send("You are not allowed to use this command.", ephemeral=True)
|
||||
await interaction.followup.send("You are not allowed to use this command.")
|
||||
return
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue