How to make an "Authorized App"?

Hey there! So recently someone who's better than me at coding showed me they made a "self-bot" of sorts that allowed slash commands in any chat they were in, and they told me that Discord made it so you could add your own "slash commands" of sorts where the App you authorized basically works. I already had my own bot, so I added it as an Authorized App (it shows up just fine on the list), but how do I proceed? How do I make it so its slash commands show up on my client? How do I handle them? I was wondering where I could get more information on this, and how to do it. Thanks!
17 Replies
d.js toolkit
d.js toolkit4mo 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
NyR
NyR4mo ago
1. It's not a self bot, it's weird to describe it as such and also a misrepresentation. 2. It is still in beta so it is not supported by discord.js yet, you can however check this announcement by discord https://discord.com/channels/222078108977594368/992166350640386090/1219333156486778944, there's also a guide on how to make them linked there, you just need to use json structures for you commands and include the two new properties mentioned in the docs, if you use builders for commands, you can convert them into json using toJSON() method and then pass the new properties and register you commands using REST
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
andy
andy4mo ago
gotcha, i appreciate it so much. is there an estimated time for when discord.js will support them? i'm assuming when it gets out of beta?
NyR
NyR4mo ago
It'll most likely be after beta, there's no estimate on when though
andy
andy4mo ago
so i think i figured it out, but i'm getting an error i've never seen before 🤔
DiscordAPIError[50001]: Missing Access
at handleErrors (D:\Andy\Coding\AndyBot\node_modules\@discordjs\rest\dist\index.js:687:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (D:\Andy\Coding\AndyBot\node_modules\@discordjs\rest\dist\index.js:1072:23)
at async SequentialHandler.queueRequest (D:\Andy\Coding\AndyBot\node_modules\@discordjs\rest\dist\index.js:913:14)
at async _REST.request (D:\Andy\Coding\AndyBot\node_modules\@discordjs\rest\dist\index.js:1218:22)
at async DMMessageManager.edit (D:\Andy\Coding\AndyBot\node_modules\discord.js\src\managers\MessageManager.js:177:15
)
at async Object.query (D:\Andy\Coding\AndyBot\functions\slashCommands.js:181:12)
at async Client.<anonymous> (D:\Andy\Coding\AndyBot\index.js:124:13) {
requestBody: {
files: [],
json: {
content: 'bla bla',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/862374724154556426/messages/1225191651144892518'
}
DiscordAPIError[50001]: Missing Access
at handleErrors (D:\Andy\Coding\AndyBot\node_modules\@discordjs\rest\dist\index.js:687:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (D:\Andy\Coding\AndyBot\node_modules\@discordjs\rest\dist\index.js:1072:23)
at async SequentialHandler.queueRequest (D:\Andy\Coding\AndyBot\node_modules\@discordjs\rest\dist\index.js:913:14)
at async _REST.request (D:\Andy\Coding\AndyBot\node_modules\@discordjs\rest\dist\index.js:1218:22)
at async DMMessageManager.edit (D:\Andy\Coding\AndyBot\node_modules\discord.js\src\managers\MessageManager.js:177:15
)
at async Object.query (D:\Andy\Coding\AndyBot\functions\slashCommands.js:181:12)
at async Client.<anonymous> (D:\Andy\Coding\AndyBot\index.js:124:13) {
requestBody: {
files: [],
json: {
content: 'bla bla',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined
}
},
rawError: { message: 'Missing Access', code: 50001 },
code: 50001,
status: 403,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/862374724154556426/messages/1225191651144892518'
}
do you recognize it?
kin.ts
kin.ts4mo ago
does the bot have permission to change channels there? or do you use user apps for this?
darp
darp4mo ago
1. its usually joke
andy
andy4mo ago
it's a user app here's the JSON i used to create it:
kin.ts
kin.ts4mo ago
then you can't edit the channel
andy
andy4mo ago
{
"name": "query",
"description": "Runs a query on the AI",
"options": [
{
"name": "prompt",
"description": "The prompt to use",
"type": 3,
"required": true
}
],
"integration_types": [
1
],
"contexts": [
0,
1,
2
]
}
{
"name": "query",
"description": "Runs a query on the AI",
"options": [
{
"name": "prompt",
"description": "The prompt to use",
"type": 3,
"required": true
}
],
"integration_types": [
1
],
"contexts": [
0,
1,
2
]
}
what do you mean? i'm editing the message, which i tried before and it works
kin.ts
kin.ts4mo ago
show your code
andy
andy4mo ago
alrighty, one sec
async function query(interaction, getBotReply, model) {
const reply = await interaction.reply({ content: "Thinking...", fetchReply: true })
const prompt = await interaction.options.getString('prompt');
const res = await getBotReply(model, [prompt]);
if (res.error) {
utils.system.logger("There seems to have been an error. Check for details.", "red", "bold");
return await reply.edit(`There seems to have been an error. Please try again, or contact @lancito01 if the issue persists.\nError details:\n\`\`\`${res.error}\`\`\``);
}
return await reply.edit({ content: res.replyText, ephemeral: false });
}
async function query(interaction, getBotReply, model) {
const reply = await interaction.reply({ content: "Thinking...", fetchReply: true })
const prompt = await interaction.options.getString('prompt');
const res = await getBotReply(model, [prompt]);
if (res.error) {
utils.system.logger("There seems to have been an error. Check for details.", "red", "bold");
return await reply.edit(`There seems to have been an error. Please try again, or contact @lancito01 if the issue persists.\nError details:\n\`\`\`${res.error}\`\`\``);
}
return await reply.edit({ content: res.replyText, ephemeral: false });
}
that's the function i'm calling with the "slash command" and it works fine if i use it in the bot DM channel
kin.ts
kin.ts4mo ago
try interaction.editReply()
andy
andy4mo ago
No description
andy
andy4mo ago
gotcha, one sec
andy
andy4mo ago
:pepe_woo:
No description
andy
andy4mo ago
seems to have worked :] thank you <3