modified: app.py

This commit is contained in:
SimolZimol
2025-10-30 21:53:40 +01:00
parent 5f4939367a
commit 4e3fe16692

20
app.py
View File

@@ -758,12 +758,28 @@ async def hoi4remove(ctx, game_name: str, user: discord.Member):
await ctx.send(f"❌ Error removing player: {str(e)}") await ctx.send(f"❌ Error removing player: {str(e)}")
@bot.hybrid_command(name='hoi4setup', description='Add a player to an existing game') @bot.hybrid_command(name='hoi4setup', description='Add a player to an existing game')
async def hoi4setup(ctx, game_name: str, user: discord.Member, team_name: str, t_level: int, country: Optional[str] = None): async def hoi4setup(ctx, game_name: str, user: discord.Member, team_name: str, t_level: int, country: Optional[str] = None, force: Optional[str] = None):
"""Add a player to an existing game""" """Add a player to an existing game. Use force='--force' to bypass MP ban."""
if t_level not in [1, 2, 3]: if t_level not in [1, 2, 3]:
await ctx.send("❌ T-Level must be 1, 2, or 3") await ctx.send("❌ T-Level must be 1, 2, or 3")
return return
# Check for MP ban role (unless --force is used)
MP_BAN_ROLE_ID = 1432368177052127353
if force != "--force":
mp_ban_role = discord.utils.get(user.roles, id=MP_BAN_ROLE_ID)
if mp_ban_role:
embed = discord.Embed(
title="🚫 Player Banned",
description=f"{user.display_name} is currently banned from multiplayer games!",
color=discord.Color.red()
)
embed.add_field(name="Banned Player", value=user.mention, inline=True)
embed.add_field(name="Ban Role", value=mp_ban_role.name, inline=True)
embed.set_footer(text="Contact an administrator if this is an error")
await ctx.send(embed=embed)
return
try: try:
async with db_pool.acquire() as conn: async with db_pool.acquire() as conn:
async with conn.cursor(aiomysql.DictCursor) as cursor: async with conn.cursor(aiomysql.DictCursor) as cursor: