Fix: Remove duplicate hytale command

This commit is contained in:
2026-01-13 16:34:11 -05:00
parent f6cf24f338
commit be50c2e203

94
bot.py
View File

@@ -657,100 +657,6 @@ async def minecraft(interaction: discord.Interaction, minecraft_username: str):
await interaction.followup.send("An error occurred.", ephemeral=True)
@client.tree.command(name="hytale", description="Whitelist a player on the Hytale server")
@app_commands.describe(hytale_username="Hytale username to whitelist")
@has_role_check(MINECRAFT_ROLE_ID)
async def hytale(interaction: discord.Interaction, hytale_username: str):
"""
Whitelist a player on the Hytale server using Pelican Panel API
"""
try:
await interaction.response.defer()
if not PELICAN_API_KEY:
logger.error("PELICAN_API_KEY not configured")
await interaction.followup.send(
"Hytale server integration not configured. Contact an admin.",
ephemeral=True
)
return
# Send whitelist command to Hytale server via Pelican API
headers = {
"Authorization": f"Bearer {PELICAN_API_KEY}",
"Accept": "Application/vnd.pterodactyl.v1+json",
"Content-Type": "application/json"
}
command_data = {
"command": f"whitelist add {hytale_username}"
}
async with aiohttp.ClientSession() as session:
async with session.post(
f"{PELICAN_URL}/api/client/servers/{HYTALE_SERVER_UUID}/command",
headers=headers,
json=command_data
) as response:
if response.status == 204:
logger.info(f"Whitelisted {hytale_username} on Hytale server")
elif response.status == 403:
logger.error("Pelican API key lacks permissions")
await interaction.followup.send(
"Bot lacks permission to control Hytale server. Contact an admin.",
ephemeral=True
)
return
elif response.status == 404:
logger.error("Hytale server not found")
await interaction.followup.send(
"Hytale server not found. Contact an admin.",
ephemeral=True
)
return
else:
error_text = await response.text()
logger.error(f"Pelican API error {response.status}: {error_text}")
await interaction.followup.send(
f"Error communicating with Hytale server (Status: {response.status})",
ephemeral=True
)
return
# Create success embed
hytale_embed = discord.Embed(
color=discord.Color.from_rgb(152, 0, 0),
title="Hytale"
)
hytale_embed.set_author(
name="(Lotus Bot)",
icon_url="https://lotusguild.org/Lotus.png"
)
hytale_embed.add_field(
name="You",
value=f"have been whitelisted on the Hytale server!",
inline=False
)
hytale_embed.add_field(
name="Server Address",
value="hytale.lotusguild.org",
inline=False
)
hytale_embed.add_field(
name="Version",
value="Latest (2026-01-13)",
inline=False
)
hytale_embed.set_footer(text="Thanks for playing on Lotus Hytale Server!")
await interaction.followup.send(embed=hytale_embed)
except Exception as e:
logger.error(f"Error in hytale command: {e}", exc_info=True)
if not interaction.response.is_done():
await interaction.response.send_message("An error occurred.", ephemeral=True)
else:
await interaction.followup.send("An error occurred.", ephemeral=True)