Skip to content

515 debug command#532

Open
Locardium wants to merge 6 commits intoInertia-Lighting:515-debug-commandfrom
Locardium:515-debug-command
Open

515 debug command#532
Locardium wants to merge 6 commits intoInertia-Lighting:515-debug-commandfrom
Locardium:515-debug-command

Conversation

@Locardium
Copy link
Copy Markdown
Member

No description provided.

@chessebuilderman chessebuilderman mentioned this pull request Mar 12, 2025
6 tasks
@inertia-git-hub
Copy link
Copy Markdown

inertia-git-hub bot commented Jun 13, 2025

The preview deployment failed. 🔴

Open Build Logs

Last updated at: 2025-06-13 18:47:18 CET

@chessebuilderman
Copy link
Copy Markdown
Member

yarn...

@chessebuilderman
Copy link
Copy Markdown
Member

Run these commands
corepack enable yarn
corepack up
yarn
Then you can git push the changes.
This branch is behind on yarn versions.

@DaRealFrost DaRealFrost requested a review from Copilot July 11, 2025 09:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a debug command for developers to get bot information, adding new developer access levels and associated permissions. The changes introduce a new bot_info command that displays system metrics like CPU usage, memory consumption, and git commit information.

  • Adds two new developer access levels (Dev and SeniorDev) to the permission system
  • Creates a new bot_info slash command restricted to developers that shows system diagnostics
  • Updates the illegal nickname handler to exempt senior developers from automatic nickname changes

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
stack.env Adds environment variables for developer role IDs
src/custom_interactions/chat_input/bot_info.ts Implements new bot_info command with system diagnostics
src/common/permissions.ts Adds developer role validation and permission checks
src/common/managers/custom_interactions_manager.ts Updates access level enum to include Dev and SeniorDev levels
src/common/handlers/illegal_nickname_handler.ts Exempts senior developers from nickname enforcement
package.json Adds process-top dependency for system monitoring

const cpu = topLoad.cpu();
const memory = topLoad.memory();

function toPorcentage (value: number): string {
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function name 'toPorcentage' has a spelling error. It should be 'toPercentage'.

Suggested change
function toPorcentage (value: number): string {
function toPercentage (value: number): string {

Copilot uses AI. Check for mistakes.
return execSync('git rev-parse HEAD').toString().trim();
} catch (error) {
console.error('Error getting commit:', error);
return 'Error to get git commit';
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message has grammatical error. Should be 'Error getting git commit' or 'Failed to get git commit'.

Suggested change
return 'Error to get git commit';
return 'Error getting git commit';

Copilot uses AI. Check for mistakes.

function getCurrentCommit(): string {
try {
return execSync('git rev-parse HEAD').toString().trim();
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using execSync with a hardcoded command is generally safe, but consider using a more secure alternative like a git library to avoid potential command injection if this pattern is used elsewhere with dynamic input.

Copilot uses AI. Check for mistakes.

//------------------------------------------------------------//

const topLoad = top(); //Need load function for have register of CPU
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment has grammatical errors. Should be 'Need to load function to register CPU' or 'Load function needed to register CPU usage'.

Suggested change
const topLoad = top(); //Need load function for have register of CPU
const topLoad = top(); //Load function needed to register CPU usage

Copilot uses AI. Check for mistakes.
if (await fetchHighestAccessLevelForUser(client, member.user) === CustomInteractionAccessLevel.Moderators) return;

const highest_access_level_for_user = await fetchHighestAccessLevelForUser(client, member.user);
if (highest_access_level_for_user === CustomInteractionAccessLevel.Moderators || highest_access_level_for_user === CustomInteractionAccessLevel.SeniorDev) return;
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic only checks for exact equality with Moderators or SeniorDev, but since access levels are hierarchical (higher numbers = higher access), this should check if the user's access level is >= Moderators to include all higher-level roles.

Suggested change
if (highest_access_level_for_user === CustomInteractionAccessLevel.Moderators || highest_access_level_for_user === CustomInteractionAccessLevel.SeniorDev) return;
if (highest_access_level_for_user >= CustomInteractionAccessLevel.Moderators) return;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants