Snipe Command

This is the command: https://pastebin.com/bjBsV6Qb This is in my index.js:
client.snipes = new Map()
client.on('messageDelete', function(message, channel) {
client.snipes.set(message.channel.id, {
content: message.content,
author: message.author,
image: message.attachments.first() ? message.attachments.first().proxyURL : null
})
})
client.snipes = new Map()
client.on('messageDelete', function(message, channel) {
client.snipes.set(message.channel.id, {
content: message.content,
author: message.author,
image: message.attachments.first() ? message.attachments.first().proxyURL : null
})
})
This is my error:
D:\CITY\commands\snipe.js:11
const msg = client.snipes.get(interaction.channel.id);
^

TypeError: Cannot read properties of undefined (reading 'snipes')
at Object.execute (D:\CITY\commands\snipe.js:11:28)
at Object.execute (D:\CITY\events\interactionCreate.js:112:15)

Node.js v18.7.0
D:\CITY\commands\snipe.js:11
const msg = client.snipes.get(interaction.channel.id);
^

TypeError: Cannot read properties of undefined (reading 'snipes')
at Object.execute (D:\CITY\commands\snipe.js:11:28)
at Object.execute (D:\CITY\events\interactionCreate.js:112:15)

Node.js v18.7.0
8 Replies
d.js toolkit
d.js toolkit17mo 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!
chewie
chewie17mo ago
Whats the purpose of this command
Youssef
Youssef17mo ago
Sniping deleted messages Thonk
chewie
chewie17mo ago
yeah but for what purpose like, why
Youssef
Youssef17mo ago
Idk tbh it's useless but so many bots have it
chewie
chewie17mo ago
and so many bots violate TOS with it
d.js docs
d.js docs17mo ago
Snipe commands are widely considered a violation of user privacy. If a message is deleted it should stay that way. - Logs for moderation purposes are fine - Bringing back a deleted message by just anyone to expose or humiliate a user is not
Youssef
Youssef17mo ago
Oh, didn't know that it violate TOS
Want results from more Discord servers?
Add your server