Spaces:
Paused
Paused
Create admincash.py
Browse files- admincash.py +18 -0
admincash.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import discord
|
| 2 |
+
from discord import app_commands
|
| 3 |
+
|
| 4 |
+
from cash import user_cash
|
| 5 |
+
|
| 6 |
+
@app_commands.command(name="admincash", description="Admin command to add cash to a specific user")
|
| 7 |
+
async def admincash(interaction: discord.Interaction, user: discord.User, amount: int):
|
| 8 |
+
if interaction.user.id != 696434794174611477:
|
| 9 |
+
await interaction.response.send_message("You are not authorized to use this command.", ephemeral=True)
|
| 10 |
+
return
|
| 11 |
+
|
| 12 |
+
user_cash[user.id] = user_cash.get(user.id, 0) + amount
|
| 13 |
+
new_balance = user_cash[user.id]
|
| 14 |
+
|
| 15 |
+
embed = discord.Embed(title="Admin Cash Added", description=f"Added ${amount:.2f} to {user.name}'s balance", color=0x00ff00)
|
| 16 |
+
embed.add_field(name="New Balance", value=f"${new_balance:.2f}", inline=False)
|
| 17 |
+
|
| 18 |
+
await interaction.response.send_message(embed=embed)
|