Skip to content

Commit

Permalink
[Badge Giver] Update v1.2.5.17
Browse files Browse the repository at this point in the history
- Added new commands for getting help for the badge
- The status command is now a debug command (development)
- Added auto update packages for the start_windows.bat file
  • Loading branch information
ItzKeyYT committed May 11, 2024
1 parent d3a2912 commit 2bbd3ae
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
35 changes: 24 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ setTimeout(() => {
const commandsToDeploy = [
{ name: 'get-badge', description: 'Get the Active Developer Badge with a simple slash command!' },
{ name: 'status', description: 'Show status of the bot.' },
{ name: 'help-badge', description: 'Get help with the badge.' },
{ name: 'badge-help', description: 'Get help with the badge.' },
];

// Log all of the existing slash commands
Expand Down Expand Up @@ -218,7 +220,7 @@ setTimeout(() => {

// Tips for copying a bot application id
console.log(`------`);
console.log("Paste this link down below in your browser to invite your bot to your server:");
console.log("Paste this link below into your browser to invite your bot to your server:");
console.log(`https://discord.com/oauth2/authorize?client_id=${clientId}&scope=bot&permissions=applications.commands`);
console.log(`-----`);
console.log('After inviting the bot to your server, type "/get-badge" to finally get your badge!');
Expand All @@ -235,27 +237,38 @@ setTimeout(() => {

try {
if (commandName === 'get-badge') {
await interaction.reply('**:white_check_mark: | You should now be able to get the Active Developer Badge!\nIf you need help, please look at this article by Discord:\nhttps://support-dev.discord.com/hc/en-us/articles/10113997751447-Active-Developer-Badge**');
console.log(`${interaction.user.tag} has run the "/get-badge" command, you can safely close this window!`);
await interaction.reply('**:white_check_mark: | You should now be able to get the Active Developer Badge!\n**');
console.log(`${interaction.user.tag} had run the "/get-badge" command, you can safely close this window!`);
};
} catch (error) {
console.log('An error occurred:', error);
await interaction.reply({ content: `**An error occurred while processing your command: \n**${error.message}`, ephemeral: true });
};

try {
if (commandName === 'help-badge' || commandName === 'badge-help') {
await interaction.reply('**Please look at the article by Discord for more information:\nhttps://support-dev.discord.com/hc/en-us/articles/10113997751447-Active-Developer-Badge**');
};
} catch (error) {
console.log('An error occurred:', error);
await interaction.reply({ content: `**An error occurred while processing your command: \n**${error.message}`, ephemeral: true });
};

// DO NOT modify anything below this line! This is only for debugging purposes.
try {
if (commandName === 'status') {
const apiPing = client.ws.ping;
const botPing = Date.now() - interaction.createdTimestamp;
// const apiPing = client.ws.ping;
// const botPing = Date.now() - interaction.createdTimestamp;

const days = Math.floor(client.uptime / 86400000);
const hours = Math.floor(client.uptime / 3600000) % 24;
const minutes = Math.floor(client.uptime / 60000) % 60;
const seconds = Math.floor(client.uptime / 1000) % 60;
// const days = Math.floor(client.uptime / 86400000);
// const hours = Math.floor(client.uptime / 3600000) % 24;
// const minutes = Math.floor(client.uptime / 60000) % 60;
// const seconds = Math.floor(client.uptime / 1000) % 60;

const uptimeFormatted = `${days}d ${hours}h ${minutes}m ${seconds}s`;
// const uptimeFormatted = `${days}d ${hours}h ${minutes}m ${seconds}s`;

await interaction.reply(`**🏓 | Pong! Here's the bot status:\n\n📡 | API Ping: ${apiPing}ms\n🏓 | Bot Ping: ${botPing}ms\n⏱️ | Uptime: ${uptimeFormatted}**`);
// await interaction.reply(`**🏓 | Pong! Here's the bot status:\n\n📡 | API Ping: ${apiPing}ms\n🏓 | Bot Ping: ${botPing}ms\n⏱️ | Uptime: ${uptimeFormatted}**`);
await interaction.reply(`**We're fixing this command, please DON'T modify anything!**`);
};

} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"WARNING": "Do not change any values in this file, especially the version number as that will mess up detecting updates.",
"name": "badgegiver",
"version": "1.2.5.16",
"version": "1.2.5.17",
"description": "A way to claim the Active Developer badge on Discord without coding",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions start_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ rem else if %major% equ 18 (
rem )

rem Node.js version is equal to or higher than v18.0.0
npm i
node index.js

rem Check if node command executed successfully
Expand Down

0 comments on commit 2bbd3ae

Please sign in to comment.