punishment system

This commit is contained in:
2024-09-03 16:48:40 +02:00
parent e8bd402126
commit 100a1cd727
3 changed files with 39 additions and 17 deletions
+34 -12
View File
@@ -44,21 +44,43 @@ async def get_aura(interaction: discord.Interaction, member: discord.Member = No
await interaction.response.send_message(embed=embed)
@tree.command(name='send', description='Send aura to a member')
async def send(interaction: discord.Interaction, to: discord.Member, amount: int):
async def send(interaction: discord.Interaction, to: discord.Member, amount: int, reason: str = ""):
aura.load()
user = aura.get(str(interaction.user.id))
user_to = aura.get(str(to.id))
if user.balance >= amount:
user.balance -= amount
user_to.balance += amount
embed = discord.Embed(
color=interaction.user.color,
description=f'**From: {interaction.user.name}\nAmount: {amount}**'
)
await to.send(embed=embed)
await interaction.response.send_message(f'Sent! You now have {user.balance} aura!', ephemeral=True)
aura.save()
if amount < 0:
amount = -amount
for r in interaction.user.roles:
if r.id in PUNISH_ROLES:
if user_to.balance >= amount:
user_to.balance -= amount
user.balance += 10
await to.send(embed=discord.Embed(
color=interaction.user.color,
title="Punished!",
description=f'**By: {interaction.user.name}\nAmount: {amount}\nReason: {reason}**'
))
await interaction.response.send_message(f'Punished! You gained 10+ aura!', ephemeral=True)
aura.save()
else:
await interaction.response.send_message(f'Cannot punish. {to.name} only has {user_to.balance} aura!', ephemeral=True)
return
if user.balance >= 10:
user.balance -= 10
await interaction.response.send_message(f'Cannot punish. You are not a developer.{" -10 aura!" if user.balance>=10 else""}', ephemeral=True)
return
else:
await interaction.response.send_message(f'Cannot send. You only have {user.balance} aura!', ephemeral=True)
if user.balance >= amount:
user.balance -= amount
user_to.balance += amount
await to.send(embed=discord.Embed(
color=interaction.user.color,
title="Aura received!",
description=f'**From: {interaction.user.name}\nAmount: {amount}**'
))
await interaction.response.send_message(f'Sent! You now have {user.balance} aura!', ephemeral=True)
aura.save()
else:
await interaction.response.send_message(f'Cannot send. You only have {user.balance} aura!', ephemeral=True)
client.run(BOT_TOKEN)