Skip to content

Commit 7439cae

Browse files
authored
Implement performance command for LuaBot
Adds a performance command to check the bot's status.
1 parent 1fcafa2 commit 7439cae

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

command/dev/performance.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import discord
2+
from discord.ext import commands
3+
4+
import squarecloud as square
5+
from dotenv import load_dotenv
6+
import os
7+
8+
load_dotenv()
9+
10+
SQUARE_TOKEN = os.getenv("SQUARE_API_KEY")
11+
SQUARE_APP_ID = os.getenv("SQUARE_APP_ID")
12+
OWNER_ID = os.getenv("OWNER_ID")
13+
14+
intents = discord.Intents.default()
15+
intents.members = True
16+
17+
bot = commands.Bot(command_prefix='+', intents=intents)
18+
19+
client = square.Client(api_key=SQUARE_TOKEN)
20+
21+
@bot.tree.command(name="performance", description="[Dev] Veja a performance da LuaBot!")
22+
async def performance(interaction: discord.Interaction):
23+
if not OWNER_ID:
24+
await interaction.response.send_message("Tá querendo ver se eu tô funcionando?")
25+
else:
26+
status = await client.app_status(SQUARE_APP_ID) # StatusData(...)
27+
28+
await interaction.response.send_message(f"Performance: **RAM:**{status.ram}, **CPU:** {status.cpu}, **Network:** {status.network}")

0 commit comments

Comments
 (0)