Exenis
Exenis
DIAdiscord.js - Imagine an app
Created by Exenis on 9/13/2024 in #djs-questions
Command dissapears
Hi there so I have this little issue with one of my new commands some useless background information. My bot is hosted on my linux server that I recently have moved it to from AWS to a cloud server everything was working perfect until I added a new command. So one day I added a new command to my command folder, I use ssh in VSCode to edit all my files, add new files etc. My new command has been added to the correct folder with all the other commands, usually I wouldn't need to rerun the deploy commands.js file in order to update the commands as I will just use
systemctl restart bot
systemctl restart bot
to update the commands as the index will run deploy-commands.js, but I noticed since I switched to the new cloud server it didn't show the new command, after clearing my discord cache (crtl+r/cmd+r), it still didn't work. so I'm confused why it doesn't work, I run deploy-commands.js manually and clear my cache again in order to hopefully view the command in the list, hmm it worked but after a few minutes I wanted to rerun the command and I get the error
Unkown integration
Unkown integration
, so I clear my discord cache again to check if it's still there and no it's not there anymore, I can do this over and over again but it keeps removing the command from the list, I am unsure what the possible problem could be. I will post the code as I don't think this is anything server related.
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const Timer = require('../../schemas/timer');

module.exports = {
data: new SlashCommandBuilder()
.setName('currentdrex')
.setDescription('Show your personal ongoing timer'),

async execute(interaction) {
const userId = interaction.user.id;
const guildId = interaction.guild.id;

const userTimer = await Timer.findOne({
userId: userId,
guildId: guildId,
type: "ongoing"
});

if (!userTimer) {
return interaction.reply({ content: "You don't have any active timers.", ephemeral: true });
}

const elapsedTime = new Date() - userTimer.startDate;

const hours = Math.floor(elapsedTime / (1000 * 60 * 60));
const minutes = Math.floor((elapsedTime % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((elapsedTime % (1000 * 60)) / 1000);

const embed = new EmbedBuilder()
.setTitle(`Your Current DREX Timer`)
.setDescription(`Elapsed time since ${new Date(userTimer.startDate).toLocaleString()}`)
.setColor('Green')
.addFields(
{ name: "Duration", value: `${hours}h ${minutes}m ${seconds}s`, inline: false }
);

await interaction.reply({ embeds: [embed] });
}
};
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
const Timer = require('../../schemas/timer');

module.exports = {
data: new SlashCommandBuilder()
.setName('currentdrex')
.setDescription('Show your personal ongoing timer'),

async execute(interaction) {
const userId = interaction.user.id;
const guildId = interaction.guild.id;

const userTimer = await Timer.findOne({
userId: userId,
guildId: guildId,
type: "ongoing"
});

if (!userTimer) {
return interaction.reply({ content: "You don't have any active timers.", ephemeral: true });
}

const elapsedTime = new Date() - userTimer.startDate;

const hours = Math.floor(elapsedTime / (1000 * 60 * 60));
const minutes = Math.floor((elapsedTime % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((elapsedTime % (1000 * 60)) / 1000);

const embed = new EmbedBuilder()
.setTitle(`Your Current DREX Timer`)
.setDescription(`Elapsed time since ${new Date(userTimer.startDate).toLocaleString()}`)
.setColor('Green')
.addFields(
{ name: "Duration", value: `${hours}h ${minutes}m ${seconds}s`, inline: false }
);

await interaction.reply({ embeds: [embed] });
}
};
while running the deploy-commands.js it will also say the correct amount of commands so nothing wrong there, if you know anything more or suggestions for me please give me a ping so I get notified of any updates in the channel appreciate the time for reading this and possible answers ❤️
20 replies