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
+1 -1
View File
@@ -39,7 +39,7 @@ class Aura:
return self.data[user_id]
def add(self, user_id) -> User:
self.data[user_id] = User(10)
self.data[user_id] = User(100)
return self.data[user_id]
def save(self):
+26 -4
View File
@@ -44,18 +44,40 @@ 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 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:
if user.balance >= amount:
user.balance -= amount
user_to.balance += amount
embed = discord.Embed(
await to.send(embed=discord.Embed(
color=interaction.user.color,
title="Aura received!",
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()
else:
+4 -4
View File
@@ -6,9 +6,9 @@ t1 = Thread(target=run, args=(['./.venv/bin/python3', 'invite_sys.py'],))
t2 = Thread(target=run, args=(['./.venv/bin/python3', 'main.py'],))
t1.daemon = True
t2.daemon = True
t1.start()
if USE_INVITE_SERVER:t2.start()
if USE_INVITE_SERVER:t1.start()
t2.start()
while 1:
if input() == 'q':
t1.join(0)
if USE_INVITE_SERVER:t2.join(0)
if USE_INVITE_SERVER:t1.join(0)
t2.join(0)