This is the Most Advance Explaination on slash commands in discord.js
Note that discord.js doesn't officially support using client.api, this is basically just a workaround until they release complete support. Do not ask for help with client.api in the discord.js server.
Note that slash commands won't show in a server unless that server has authorized it with the applications.commands
oauth2 scope (not just the bot
scope).
This does not require a discord.js update! It should work as long as you're using discord.js v12 it will work fine.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { APIMessage, Structures } = require("discord.js"); | |
class ExtAPIMessage extends APIMessage { | |
resolveData() { | |
if (this.data) return this; | |
super.resolveData(); | |
const allowedMentions = this.options.allowedMentions || this.target.client.options.allowedMentions || {}; | |
if (allowedMentions.repliedUser !== undefined) { | |
if (this.data.allowed_mentions === undefined) this.data.allowed_mentions = {}; | |
Object.assign(this.data.allowed_mentions, { replied_user: allowedMentions.repliedUser }); |