punishment system
This commit is contained in:
@@ -39,7 +39,7 @@ class Aura:
|
|||||||
return self.data[user_id]
|
return self.data[user_id]
|
||||||
|
|
||||||
def add(self, user_id) -> User:
|
def add(self, user_id) -> User:
|
||||||
self.data[user_id] = User(10)
|
self.data[user_id] = User(100)
|
||||||
return self.data[user_id]
|
return self.data[user_id]
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
|||||||
@@ -44,18 +44,40 @@ async def get_aura(interaction: discord.Interaction, member: discord.Member = No
|
|||||||
await interaction.response.send_message(embed=embed)
|
await interaction.response.send_message(embed=embed)
|
||||||
|
|
||||||
@tree.command(name='send', description='Send aura to a member')
|
@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()
|
aura.load()
|
||||||
user = aura.get(str(interaction.user.id))
|
user = aura.get(str(interaction.user.id))
|
||||||
user_to = aura.get(str(to.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:
|
if user.balance >= amount:
|
||||||
user.balance -= amount
|
user.balance -= amount
|
||||||
user_to.balance += amount
|
user_to.balance += amount
|
||||||
embed = discord.Embed(
|
await to.send(embed=discord.Embed(
|
||||||
color=interaction.user.color,
|
color=interaction.user.color,
|
||||||
|
title="Aura received!",
|
||||||
description=f'**From: {interaction.user.name}\nAmount: {amount}**'
|
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)
|
await interaction.response.send_message(f'Sent! You now have {user.balance} aura!', ephemeral=True)
|
||||||
aura.save()
|
aura.save()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -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'],))
|
t2 = Thread(target=run, args=(['./.venv/bin/python3', 'main.py'],))
|
||||||
t1.daemon = True
|
t1.daemon = True
|
||||||
t2.daemon = True
|
t2.daemon = True
|
||||||
t1.start()
|
if USE_INVITE_SERVER:t1.start()
|
||||||
if USE_INVITE_SERVER:t2.start()
|
t2.start()
|
||||||
while 1:
|
while 1:
|
||||||
if input() == 'q':
|
if input() == 'q':
|
||||||
t1.join(0)
|
if USE_INVITE_SERVER:t1.join(0)
|
||||||
if USE_INVITE_SERVER:t2.join(0)
|
t2.join(0)
|
||||||
Reference in New Issue
Block a user