Turkinator
Turkinator
Explore posts from servers
SIASapphire - Imagine a framework
Created by Turkinator on 2/13/2024 in #sapphire-support
Using Paths w/ TypeScript
Turns out that compiling it then running it with tsx works perfectly fine
"main": "dist/index.js",
"type": "module",
"scripts": {
"compile": "tsc && tsx .",
"dev": "tsc-watch --onSuccess \"tsx .\""
},
"main": "dist/index.js",
"type": "module",
"scripts": {
"compile": "tsc && tsx .",
"dev": "tsc-watch --onSuccess \"tsx .\""
},
6 replies
SIASapphire - Imagine a framework
Created by Turkinator on 2/13/2024 in #sapphire-support
Using Paths w/ TypeScript
Ah actually I found a fix lol
6 replies
SIASapphire - Imagine a framework
Created by Turkinator on 2/13/2024 in #sapphire-support
Using Paths w/ TypeScript
My explanation seems to be quite vague, so please ask any questions
6 replies
SIASapphire - Imagine a framework
Created by Turkinator on 12/12/2023 in #discordjs-support
Editing an ephemeral reply from an interaction handler
ABSOLUTE LIFE SAVER
9 replies
SIASapphire - Imagine a framework
Created by Turkinator on 12/12/2023 in #discordjs-support
Editing an ephemeral reply from an interaction handler
I've tried fetching it by the fetched reply's ID which works, although then you can't update/edit the ephemeral message
9 replies
SIASapphire - Imagine a framework
Created by Turkinator on 12/12/2023 in #discordjs-support
Editing an ephemeral reply from an interaction handler
The main question I'm asking is how to edit an ephemeral message from another file
9 replies
SIASapphire - Imagine a framework
Created by Turkinator on 12/12/2023 in #discordjs-support
Editing an ephemeral reply from an interaction handler
what
9 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 11/12/2023 in #djs-questions
Fetching a slash command reply's ID before it's sent
It worked for normal messages, but not for ephemeral ones
6 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 11/12/2023 in #djs-questions
Fetching a slash command reply's ID before it's sent
Is there a way for ephemeral messages?
6 replies
SIASapphire - Imagine a framework
Created by Turkinator on 11/8/2023 in #discordjs-support
Making multi-line embed descriptions cleaner
tyyyy
7 replies
SIASapphire - Imagine a framework
Created by Turkinator on 10/7/2023 in #sapphire-support
Specifying Types
As you can see it's specifying the type (or whatever it's called) to any, although I was wondering if I can mark it as a TextChannel as that's what it is?
5 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 7/25/2023 in #djs-questions
Error when trying to show modal after clicking button.
tyyy
17 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 7/25/2023 in #djs-questions
Error when trying to show modal after clicking button.
Ok it's working now
17 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 7/25/2023 in #djs-questions
Error when trying to show modal after clicking button.
I used setPlaceholder instead of setLabel on the text input
17 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 7/25/2023 in #djs-questions
Error when trying to show modal after clicking button.
I see
17 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 7/25/2023 in #djs-questions
Error when trying to show modal after clicking button.
Oh wait
17 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 7/25/2023 in #djs-questions
Error when trying to show modal after clicking button.
// Dependencies
const { ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder } = require("discord.js");

module.exports = async function (interaction) {
// Variables
let msg;
let collector;

// Buttons
const editDataButton = new ButtonBuilder()
.setCustomId("editDataButton")
.setLabel("EditID")
.setStyle(ButtonStyle.Primary);
const editDataRow = new ActionRowBuilder().addComponents(editDataButton);

// Modals
const editIDModal = new ModalBuilder()
.setCustomId("editIDModal")
.setTitle("EditID")

// Text Inputs
const IDInput = new TextInputBuilder()
.setCustomId("IDInput")
.setPlaceholder("ID")
.setStyle(TextInputStyle.Short)
.setMinLength(1)
.setMaxLength(20)
.setRequired(true);
const IDInputRow = new ActionRowBuilder().addComponents(IDInput);

// Set Modal Components
editIDModal.addComponents(IDInputRow);

msg = await interaction.reply({
content: "Please edit your account ID below.",
ephemeral: true,
components: [editDataRow],
});

collector = msg.createMessageComponentCollector();

collector.on("collect", async (i) => {
if (i.customId == "editDataButton") {
await i.showModal(editIDModal)
}
});
};
// Dependencies
const { ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder } = require("discord.js");

module.exports = async function (interaction) {
// Variables
let msg;
let collector;

// Buttons
const editDataButton = new ButtonBuilder()
.setCustomId("editDataButton")
.setLabel("EditID")
.setStyle(ButtonStyle.Primary);
const editDataRow = new ActionRowBuilder().addComponents(editDataButton);

// Modals
const editIDModal = new ModalBuilder()
.setCustomId("editIDModal")
.setTitle("EditID")

// Text Inputs
const IDInput = new TextInputBuilder()
.setCustomId("IDInput")
.setPlaceholder("ID")
.setStyle(TextInputStyle.Short)
.setMinLength(1)
.setMaxLength(20)
.setRequired(true);
const IDInputRow = new ActionRowBuilder().addComponents(IDInput);

// Set Modal Components
editIDModal.addComponents(IDInputRow);

msg = await interaction.reply({
content: "Please edit your account ID below.",
ephemeral: true,
components: [editDataRow],
});

collector = msg.createMessageComponentCollector();

collector.on("collect", async (i) => {
if (i.customId == "editDataButton") {
await i.showModal(editIDModal)
}
});
};
17 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 7/25/2023 in #djs-questions
Error when trying to show modal after clicking button.
C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@sapphire\shapeshift\dist\index.js:1715
return typeof value === "string" ? Result.ok(value) : Result.err(new ValidationError("s.string", "Expected a string primitive", value));
^

ValidationError: Expected a string primitive
at StringValidator.handle (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@sapphire\shapeshift\dist\index.js:1715:70)
at StringValidator.parse (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@sapphire\shapeshift\dist\index.js:212:88)
at validateRequiredParameters (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1064:18)
at TextInputBuilder.toJSON (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1172:5)
at C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1285:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1285:35)
at C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1374:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1374:35) {
validator: 's.string',
given: undefined
}
C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@sapphire\shapeshift\dist\index.js:1715
return typeof value === "string" ? Result.ok(value) : Result.err(new ValidationError("s.string", "Expected a string primitive", value));
^

ValidationError: Expected a string primitive
at StringValidator.handle (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@sapphire\shapeshift\dist\index.js:1715:70)
at StringValidator.parse (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@sapphire\shapeshift\dist\index.js:212:88)
at validateRequiredParameters (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1064:18)
at TextInputBuilder.toJSON (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1172:5)
at C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1285:64
at Array.map (<anonymous>)
at ActionRowBuilder.toJSON (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1285:35)
at C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1374:64
at Array.map (<anonymous>)
at ModalBuilder.toJSON (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\builders\dist\index.js:1374:35) {
validator: 's.string',
given: undefined
}
17 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 7/25/2023 in #djs-questions
Error when trying to show modal after clicking button.
o
17 replies
DIAdiscord.js - Imagine an app
Created by Turkinator on 7/25/2023 in #djs-questions
Error when trying to show modal after clicking button.
Invalid form body error 😔
C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\rest\dist\index.js:640
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 1521 in length.
at handleErrors (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\rest\dist\index.js:736:23)
at async REST.request (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async ButtonInteraction.showModal (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:253:5)
at async InteractionCollector.<anonymous> (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\src\commands\link.js:43:13) {
requestBody: {
files: undefined,
json: {
type: 9,
data: {
custom_id: 'editIDModal',
title: 'EditID',
components: [ { type: 1, data: [Object], components: [] } ]
}
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
data: { components: { '0': { components: [Object] } } }
}
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1133262297863827536/aW50ZXJhY3Rpb246MTEzMzI2MjI5Nzg2MzgyNzUzNjp1OWVQR2ZRS2p4Vm1TeWdjUGVGc05EM0l0aTNvb1ZMY054YWs1MnBFSnBMNnVtbHJGNkZBMU43aVY1WDRhNDlZNXQ0UmFRTE1jYWN4S0hoRmhJV3hEa3I3OVFnZVpicG9UcHN/callback'
}
C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\rest\dist\index.js:640
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50035]: Invalid Form Body
data.components[0].components[BASE_TYPE_BAD_LENGTH]: Must be between 1 and 1521 in length.
at handleErrors (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\rest\dist\index.js:736:23)
at async REST.request (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\@discordjs\rest\dist\index.js:1387:22)
at async ButtonInteraction.showModal (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:253:5)
at async InteractionCollector.<anonymous> (C:\Users\Aiden\Desktop\Projects\NodeJS\Discord\devbot\src\commands\link.js:43:13) {
requestBody: {
files: undefined,
json: {
type: 9,
data: {
custom_id: 'editIDModal',
title: 'EditID',
components: [ { type: 1, data: [Object], components: [] } ]
}
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
data: { components: { '0': { components: [Object] } } }
}
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/interactions/1133262297863827536/aW50ZXJhY3Rpb246MTEzMzI2MjI5Nzg2MzgyNzUzNjp1OWVQR2ZRS2p4Vm1TeWdjUGVGc05EM0l0aTNvb1ZMY054YWs1MnBFSnBMNnVtbHJGNkZBMU43aVY1WDRhNDlZNXQ0UmFRTE1jYWN4S0hoRmhJV3hEa3I3OVFnZVpicG9UcHN/callback'
}
17 replies