Searching discord.js Documentation

I'm trying to make a slash command to get documentation on specific topics on discord.js, however I don't know how lol
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('docs')
.setDescription('Search discord.js documentation!')
.addStringOption(option =>
option.setName('query')
.setDescription('Phrase to search for')
.setAutocomplete(true)),

async autocomplete(interaction) {
const focusedValue = interaction.options.getFocused();
const choices = ['Popular Topics: Threads', 'Sharding: Getting started', 'Library: Voice Connections', 'Interactions: Replying to slash commands', 'Popular Topics: Embed preview'];
const filtered = choices.filter(choice => choice.startsWith(focusedValue));
await interaction.respond(
filtered.map(choice => ({ name: choice, value: choice })),
);
},

async code(interaction) {

},
};
const { SlashCommandBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('docs')
.setDescription('Search discord.js documentation!')
.addStringOption(option =>
option.setName('query')
.setDescription('Phrase to search for')
.setAutocomplete(true)),

async autocomplete(interaction) {
const focusedValue = interaction.options.getFocused();
const choices = ['Popular Topics: Threads', 'Sharding: Getting started', 'Library: Voice Connections', 'Interactions: Replying to slash commands', 'Popular Topics: Embed preview'];
const filtered = choices.filter(choice => choice.startsWith(focusedValue));
await interaction.respond(
filtered.map(choice => ({ name: choice, value: choice })),
);
},

async code(interaction) {

},
};
This is what i've got so far ( from discord.js documentation)
4 Replies
d.js toolkit
d.js toolkit3mo 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
Whisperer
WhispererOP3mo ago
I'd prefer to code it (It's how I learn), so i'll definetly look at the open source! Thanks
souji
souji3mo ago
heads up: you can't replicate what i do with it exactly, since i use database access for the djs docs
Whisperer
WhispererOP3mo ago
uh I've made a command once to search through a wiki page and find information on something, I wish discord.js could be as easy
Want results from more Discord servers?
Add your server