Skip to content

Commit 8fb9568

Browse files
committed
fix layout
1 parent 99f1749 commit 8fb9568

28 files changed

Lines changed: 538 additions & 308 deletions

.github/workflows/Ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858

5959
# ── Upload coverage report ─────────────────────────────────────────────
6060
- name: Upload coverage report
61-
if: matrix.node-version == '20.x' # upload once, not per matrix leg
61+
if: matrix.node-version == '20.x' # upload once, not per matrix leg
6262
uses: actions/upload-artifact@v4
6363
with:
6464
name: coverage-report

.github/workflows/codeql.yml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ name: "CodeQL Advanced"
1313

1414
on:
1515
push:
16-
branches: [ "main" ]
16+
branches: ["main"]
1717
pull_request:
18-
branches: [ "main" ]
18+
branches: ["main"]
1919
schedule:
20-
- cron: '22 1 * * 3'
20+
- cron: "22 1 * * 3"
2121

2222
jobs:
2323
analyze:
@@ -43,8 +43,8 @@ jobs:
4343
fail-fast: false
4444
matrix:
4545
include:
46-
- language: javascript-typescript
47-
build-mode: none
46+
- language: javascript-typescript
47+
build-mode: none
4848
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
4949
# Use `c-cpp` to analyze code written in C, C++ or both
5050
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
@@ -54,46 +54,46 @@ jobs:
5454
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
5555
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
5656
steps:
57-
- name: Checkout repository
58-
uses: actions/checkout@v4
57+
- name: Checkout repository
58+
uses: actions/checkout@v4
5959

60-
# Add any setup steps before running the `github/codeql-action/init` action.
61-
# This includes steps like installing compilers or runtimes (`actions/setup-node`
62-
# or others). This is typically only required for manual builds.
63-
# - name: Setup runtime (example)
64-
# uses: actions/setup-example@v1
60+
# Add any setup steps before running the `github/codeql-action/init` action.
61+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
62+
# or others). This is typically only required for manual builds.
63+
# - name: Setup runtime (example)
64+
# uses: actions/setup-example@v1
6565

66-
# Initializes the CodeQL tools for scanning.
67-
- name: Initialize CodeQL
68-
uses: github/codeql-action/init@v4
69-
with:
70-
languages: ${{ matrix.language }}
71-
build-mode: ${{ matrix.build-mode }}
72-
# If you wish to specify custom queries, you can do so here or in a config file.
73-
# By default, queries listed here will override any specified in a config file.
74-
# Prefix the list here with "+" to use these queries and those in the config file.
66+
# Initializes the CodeQL tools for scanning.
67+
- name: Initialize CodeQL
68+
uses: github/codeql-action/init@v4
69+
with:
70+
languages: ${{ matrix.language }}
71+
build-mode: ${{ matrix.build-mode }}
72+
# If you wish to specify custom queries, you can do so here or in a config file.
73+
# By default, queries listed here will override any specified in a config file.
74+
# Prefix the list here with "+" to use these queries and those in the config file.
7575

76-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
77-
# queries: security-extended,security-and-quality
76+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
77+
# queries: security-extended,security-and-quality
7878

79-
# If the analyze step fails for one of the languages you are analyzing with
80-
# "We were unable to automatically build your code", modify the matrix above
81-
# to set the build mode to "manual" for that language. Then modify this step
82-
# to build your code.
83-
# ℹ️ Command-line programs to run using the OS shell.
84-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
85-
- name: Run manual build steps
86-
if: matrix.build-mode == 'manual'
87-
shell: bash
88-
run: |
89-
echo 'If you are using a "manual" build mode for one or more of the' \
90-
'languages you are analyzing, replace this with the commands to build' \
91-
'your code, for example:'
92-
echo ' make bootstrap'
93-
echo ' make release'
94-
exit 1
79+
# If the analyze step fails for one of the languages you are analyzing with
80+
# "We were unable to automatically build your code", modify the matrix above
81+
# to set the build mode to "manual" for that language. Then modify this step
82+
# to build your code.
83+
# ℹ️ Command-line programs to run using the OS shell.
84+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
85+
- name: Run manual build steps
86+
if: matrix.build-mode == 'manual'
87+
shell: bash
88+
run: |
89+
echo 'If you are using a "manual" build mode for one or more of the' \
90+
'languages you are analyzing, replace this with the commands to build' \
91+
'your code, for example:'
92+
echo ' make bootstrap'
93+
echo ' make release'
94+
exit 1
9595
96-
- name: Perform CodeQL Analysis
97-
uses: github/codeql-action/analyze@v4
98-
with:
99-
category: "/language:${{matrix.language}}"
96+
- name: Perform CodeQL Analysis
97+
uses: github/codeql-action/analyze@v4
98+
with:
99+
category: "/language:${{matrix.language}}"

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"tabWidth": 2,
55
"trailingComma": "es5",
66
"printWidth": 100
7-
}
7+
}

.vscode/settings.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"editor.formatOnPaste": true,
3-
"editor.formatOnSave": true,
4-
"prettier.printWidth": 1000,
5-
"explorer.compactFolders": false,
6-
"cSpell.words": [
7-
"autoposter",
8-
"AUTORESTART",
9-
"botowner",
10-
"cooldowns",
11-
"discordbotlist",
12-
"guildevents",
13-
"jlhelper",
14-
"topgg"
15-
]
16-
}
2+
"editor.formatOnPaste": true,
3+
"editor.formatOnSave": true,
4+
"prettier.printWidth": 1000,
5+
"explorer.compactFolders": false,
6+
"cSpell.words": [
7+
"autoposter",
8+
"AUTORESTART",
9+
"botowner",
10+
"cooldowns",
11+
"discordbotlist",
12+
"guildevents",
13+
"jlhelper",
14+
"topgg"
15+
]
16+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Helper-bot
2+
23
This is the repo for Java Lava's Helper discord bot
Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,59 @@
1-
const { EmbedBuilder, version: discordJsVersion, PermissionsBitField } = require('discord.js');
2-
const process = require('process');
3-
const { logger } = require('../../../../utils/logger');
4-
const { LogError } = require('../../../../utils/LogError');
5-
const { supportinvite } = require('../../../../utils/support-invite');
1+
const { EmbedBuilder, version: discordJsVersion, PermissionsBitField } = require("discord.js");
2+
const process = require("process");
3+
const { logger } = require("../../../../utils/logger");
4+
const { LogError } = require("../../../../utils/LogError");
5+
const { supportinvite } = require("../../../../utils/support-invite");
66

77
module.exports = {
8-
Name: 'helper-debug',
9-
Description: 'Check bot performance, latency, and memory usage.',
10-
Aliases: ['hdebug', 'debughelper'],
11-
async execute(message, args) {
12-
try {
13-
// Check permissions
14-
if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ViewChannel)) {
15-
return message.reply('You do not have permission to use this command.');
16-
}
8+
Name: "helper-debug",
9+
Description: "Check bot performance, latency, and memory usage.",
10+
Aliases: ["hdebug", "debughelper"],
11+
async execute(message, args) {
12+
try {
13+
// Check permissions
14+
if (
15+
!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ViewChannel)
16+
) {
17+
return message.reply("You do not have permission to use this command.");
18+
}
1719

18-
const sentMessage = await message.reply('📊 Gathering debug information...');
19-
20-
const ping = sentMessage.createdTimestamp - message.createdTimestamp;
21-
const memoryUsage = process.memoryUsage();
22-
const rssMB = (memoryUsage.rss / 1024 / 1024).toFixed(2);
23-
const heapMB = (memoryUsage.heapUsed / 1024 / 1024).toFixed(2);
20+
const sentMessage = await message.reply("📊 Gathering debug information...");
2421

25-
const embed = new EmbedBuilder()
26-
.setTitle('📊 Bot Debug Info')
27-
.setColor('Blurple')
28-
.addFields(
29-
{ name: 'API Latency', value: `${message.client.ws.ping}ms`, inline: true },
30-
{ name: 'Response Time', value: `${ping}ms`, inline: true },
31-
{ name: 'Guilds Served', value: `${message.client.guilds.cache.size}`, inline: true },
32-
{ name: 'Memory (RSS)', value: `${rssMB} MB`, inline: true },
33-
{ name: 'Memory (Heap Used)', value: `${heapMB} MB`, inline: true },
34-
{ name: 'Discord.js Version', value: discordJsVersion, inline: true },
35-
{ name: 'Shard ID', value: `${message.guild?.shardId ?? 'N/A'}`, inline: true }
36-
)
37-
.setFooter({ text: 'If you experience lag, report this data to the support team.' })
38-
.setTimestamp();
22+
const ping = sentMessage.createdTimestamp - message.createdTimestamp;
23+
const memoryUsage = process.memoryUsage();
24+
const rssMB = (memoryUsage.rss / 1024 / 1024).toFixed(2);
25+
const heapMB = (memoryUsage.heapUsed / 1024 / 1024).toFixed(2);
3926

40-
await sentMessage.edit({ content: null, embeds: [embed] });
41-
} catch (err) {
42-
if (err && err.code === 10062) return;
43-
try {
44-
await message.reply({ content: `An error occurred while running the command. Please report this to the support server ${supportinvite}` });
45-
logger.error(`[Stable Debug] Error executing command for ${message.author.tag}: ${err?.message ?? err}`, err);
46-
LogError(err, message, 'commands/prefix/public/utility/helper-debug.js');
47-
} catch (Err) {
48-
return;
49-
}
50-
}
27+
const embed = new EmbedBuilder()
28+
.setTitle("📊 Bot Debug Info")
29+
.setColor("Blurple")
30+
.addFields(
31+
{ name: "API Latency", value: `${message.client.ws.ping}ms`, inline: true },
32+
{ name: "Response Time", value: `${ping}ms`, inline: true },
33+
{ name: "Guilds Served", value: `${message.client.guilds.cache.size}`, inline: true },
34+
{ name: "Memory (RSS)", value: `${rssMB} MB`, inline: true },
35+
{ name: "Memory (Heap Used)", value: `${heapMB} MB`, inline: true },
36+
{ name: "Discord.js Version", value: discordJsVersion, inline: true },
37+
{ name: "Shard ID", value: `${message.guild?.shardId ?? "N/A"}`, inline: true }
38+
)
39+
.setFooter({ text: "If you experience lag, report this data to the support team." })
40+
.setTimestamp();
41+
42+
await sentMessage.edit({ content: null, embeds: [embed] });
43+
} catch (err) {
44+
if (err && err.code === 10062) return;
45+
try {
46+
await message.reply({
47+
content: `An error occurred while running the command. Please report this to the support server ${supportinvite}`,
48+
});
49+
logger.error(
50+
`[Stable Debug] Error executing command for ${message.author.tag}: ${err?.message ?? err}`,
51+
err
52+
);
53+
LogError(err, message, "commands/prefix/public/utility/helper-debug.js");
54+
} catch (Err) {
55+
return;
56+
}
5157
}
52-
};
58+
},
59+
};

commands/prefix/public/utility/ping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ module.exports = {
1515
const apiLatency = client.ws.ping;
1616
await sentMessage.edit(`Pong!\nBot Latency: ${botLatency}ms\nAPI Latency: ${apiLatency}ms`);
1717
},
18-
};
18+
};
Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,51 @@
1-
const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits, MessageFlags } = require("discord.js");
1+
const {
2+
SlashCommandBuilder,
3+
EmbedBuilder,
4+
PermissionFlagsBits,
5+
MessageFlags,
6+
} = require("discord.js");
27
const { logger } = require("../../../utils/logger");
38
const { LogError } = require("../../../utils/LogError");
49

510
module.exports = {
6-
data: new SlashCommandBuilder().setName("scheduled-messages").setDescription("View all scheduled messages in this server").setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
11+
data: new SlashCommandBuilder()
12+
.setName("scheduled-messages")
13+
.setDescription("View all scheduled messages in this server")
14+
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
715
async execute(interaction) {
816
try {
917
// Fetch scheduled messages for the guild
10-
const scheduledMessages = await interaction.client.db.ScheduledMessage.find({ GuildID: interaction.guild.id });
18+
const scheduledMessages = await interaction.client.db.ScheduledMessage.find({
19+
GuildID: interaction.guild.id,
20+
});
1121
if (scheduledMessages.length === 0) {
12-
return interaction.reply({ content: "There are no scheduled messages in this server.", flags: MessageFlags.Ephemeral });
22+
return interaction.reply({
23+
content: "There are no scheduled messages in this server.",
24+
flags: MessageFlags.Ephemeral,
25+
});
1326
}
1427

1528
// Create an embed to display the scheduled messages
1629
const embed = new EmbedBuilder()
1730
.setTitle("Scheduled Messages")
18-
.setDescription(scheduledMessages.map((msg) => `**ID:** ${msg._id}\n**Channel:** <#${msg.ChannelID}>\n**Content:** ${msg.Content}\n**Scheduled Time:** <t:${Math.floor(new Date(msg.ScheduledTime).getTime() / 1000)}:F>`).join("\n\n"))
31+
.setDescription(
32+
scheduledMessages
33+
.map(
34+
(msg) =>
35+
`**ID:** ${msg._id}\n**Channel:** <#${msg.ChannelID}>\n**Content:** ${msg.Content}\n**Scheduled Time:** <t:${Math.floor(new Date(msg.ScheduledTime).getTime() / 1000)}:F>`
36+
)
37+
.join("\n\n")
38+
)
1939
.setColor("Blue")
2040
.setTimestamp();
2141
await interaction.reply({ embeds: [embed], flags: MessageFlags.Ephemeral });
2242
} catch (error) {
2343
logger.error(`Error executing /scheduled-messages: ${error}`);
2444
LogError(interaction.client, error, "Slash Command: /scheduled-messages");
25-
await interaction.reply({ content: "An error occurred while fetching scheduled messages. Please try again later.", flags: MessageFlags.Ephemeral });
45+
await interaction.reply({
46+
content: "An error occurred while fetching scheduled messages. Please try again later.",
47+
flags: MessageFlags.Ephemeral,
48+
});
2649
}
2750
},
2851
};

0 commit comments

Comments
 (0)