I don't have the necessary parametres

const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
const { seniorGuild } = require('../../configs/config.json');
const { bot } = require('../../configs/config.json');

const id = seniorGuild.ID;
const logs = seniorGuild.commandLogs;

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('A Command to check if the bot is still online.'),
async execute(interaction) {
await interaction.reply({content: 'pong!', ephemeral: true});
},
};
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
const { seniorGuild } = require('../../configs/config.json');
const { bot } = require('../../configs/config.json');

const id = seniorGuild.ID;
const logs = seniorGuild.commandLogs;

module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('A Command to check if the bot is still online.'),
async execute(interaction) {
await interaction.reply({content: 'pong!', ephemeral: true});
},
};
This is my code, below the last line, I keep trying to do const guild = await interaction.client.etc.. - but client isn't a valid parametre
6 Replies
d.js toolkit
d.js toolkit5mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
treble/luna
treble/luna5mo ago
It is If you actually pass in an interaction
d.js docs
d.js docs5mo ago
The order of function parameters must match between definition and function call.
function execute(client, interaction) { ... };
execute(interaction, client);
function execute(client, interaction) { ... };
execute(interaction, client);
- mismatch! you pass an interaction where the client is expected - mismatch! you pass the client where an interaction is expected
chay
chayOP5mo ago
i mean like how it should just be a default attribute to interaction I meant attribute not parametre sorry when you do interaction. there should be attributes that pop up by default on there like interaction.guild etc.. mine doesn't show that
treble/luna
treble/luna5mo ago
thats expected js doesnt have autocomplete You need to use jsdoc or typescript
chay
chayOP5mo ago
ohh
/**
* @param {import('discord.js').ChatInputCommandInteraction} interaction
*/
/**
* @param {import('discord.js').ChatInputCommandInteraction} interaction
*/
Should I use this? Yeah, resolved - thanks

Did you find this page helpful?