Magic Numbers Everywhere #11

Open
opened 2026-02-02 15:11:46 -05:00 by jared · 0 comments
Owner

if len(hytale_username) < 3 or len(hytale_username) > 16:

Fix:

At top of file with other constants

MIN_USERNAME_LENGTH = 3
MAX_USERNAME_LENGTH = 16
MAX_POLL_OPTIONS = 10
MAX_DICE_SIDES = 100
MAX_DICE_COUNT = 20

Usage:

if not (MIN_USERNAME_LENGTH <= len(username) <= MAX_USERNAME_LENGTH):
await interaction.followup.send(
f"Username must be {MIN_USERNAME_LENGTH}-{MAX_USERNAME_LENGTH} characters",
ephemeral=True
)

if len(hytale_username) < 3 or len(hytale_username) > 16: Fix: # At top of file with other constants MIN_USERNAME_LENGTH = 3 MAX_USERNAME_LENGTH = 16 MAX_POLL_OPTIONS = 10 MAX_DICE_SIDES = 100 MAX_DICE_COUNT = 20 # Usage: if not (MIN_USERNAME_LENGTH <= len(username) <= MAX_USERNAME_LENGTH): await interaction.followup.send( f"Username must be {MIN_USERNAME_LENGTH}-{MAX_USERNAME_LENGTH} characters", ephemeral=True )
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/discordBot#11