Broken Command Handler

Hello! This handler was jsut working for me but when I changed the file name it just broke
4 Replies
d.js toolkit
d.js toolkit12mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Goodin
Goodin12mo ago
so I figured out the first problem the problem I am having now is it is giving me null when uploading a file and trying to get the URL it was working just fine before I chagned the name of the command for some reason
module.exports = {
data: new SlashCommandBuilder()
.setName('scrape')
.setDescription('Scrape a username list')
.addAttachmentOption(option =>
option.setName('file')
.setDescription('Input a file to be scraped')),
async execute(interaction) {


// Create embed with league information


const attachment = interaction.options.getAttachment("input")

const url = attachment.url
const response = await axios.get(url);
console.log(response)
// if there was an error send a message with the status
if (!response.ok){
console.log(response.statusText)
}

// take the response stream and read it to completion
const text = response.data;
var test = ""
module.exports = {
data: new SlashCommandBuilder()
.setName('scrape')
.setDescription('Scrape a username list')
.addAttachmentOption(option =>
option.setName('file')
.setDescription('Input a file to be scraped')),
async execute(interaction) {


// Create embed with league information


const attachment = interaction.options.getAttachment("input")

const url = attachment.url
const response = await axios.get(url);
console.log(response)
// if there was an error send a message with the status
if (!response.ok){
console.log(response.statusText)
}

// take the response stream and read it to completion
const text = response.data;
var test = ""
I am getting that the url in attachment.url is blank
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Goodin
Goodin12mo ago
i'm a idiot i changed the name