potsu
potsu
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by potsu on 4/8/2024 in #djs-questions
how to handle "unknown interaction" error
try {
return await interaction.reply(...);
} catch (error) {
if ((error as Error).message.includes("Unknown interaction")) {
return await interaction.reply(...);
{
console.error(Error);
return null;
}
}
try {
return await interaction.reply(...);
} catch (error) {
if ((error as Error).message.includes("Unknown interaction")) {
return await interaction.reply(...);
{
console.error(Error);
return null;
}
}
if the "unknown interaction" error occurs, should i try to reply to the interaction again or wut? i think the error occurs when the user is lagging
10 replies
DIAdiscord.js - Imagine an app
Created by potsu on 2/23/2024 in #djs-questions
is accessing the message object from interaction response possible?
client.on("interactionCreate", async int => {
if (int.isCommand()) {
const SentResponse = await int.reply(...);
try {
const Input = await SentResponse.awaitMessageComponent(...);
} catch (error) {
const components = SentResponse.message.components;
await SentResponse.update(...);
}
}
});
client.on("interactionCreate", async int => {
if (int.isCommand()) {
const SentResponse = await int.reply(...);
try {
const Input = await SentResponse.awaitMessageComponent(...);
} catch (error) {
const components = SentResponse.message.components;
await SentResponse.update(...);
}
}
});
apparently "message" doesn't exist on SentResponse. So how do I get the message object of the reply or is it not possible?
7 replies
DIAdiscord.js - Imagine an app
Created by potsu on 11/14/2022 in #djs-questions
error message does not tell me the error
C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@sapphire\shapeshift\src\validators\ArrayValidator.ts:21
export class ArrayValidator<T extends unknown[], I = T[number]> extends BaseValidator<T> {
^
Error: Received one or more errors // <- what are the errors??
at ArrayValidator.handle (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@sapphire\shapeshift\src\validators\ArrayValidator.ts:21:14)
at ArrayValidator.parse (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@sapphire\shapeshift\src\validators\BaseValidator.ts:102:48)
at EmbedBuilder.spliceFields (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@discordjs\builders\src\messages\embed\Embed.ts:32:31)
at EmbedBuilder.setFields (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@discordjs\builders\src\messages\embed\Embed.ts:40:10)
at Object.<anonymous> (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\src\Game\Commands\Explore\@Domain.ts:250:18) // <- the file
C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@sapphire\shapeshift\src\validators\ArrayValidator.ts:21
export class ArrayValidator<T extends unknown[], I = T[number]> extends BaseValidator<T> {
^
Error: Received one or more errors // <- what are the errors??
at ArrayValidator.handle (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@sapphire\shapeshift\src\validators\ArrayValidator.ts:21:14)
at ArrayValidator.parse (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@sapphire\shapeshift\src\validators\BaseValidator.ts:102:48)
at EmbedBuilder.spliceFields (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@discordjs\builders\src\messages\embed\Embed.ts:32:31)
at EmbedBuilder.setFields (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\node_modules\@discordjs\builders\src\messages\embed\Embed.ts:40:10)
at Object.<anonymous> (C:\Users\wolfg\OneDrive\Desktop\Karyl-Chan\src\Game\Commands\Explore\@Domain.ts:250:18) // <- the file
@Domain.ts at line 250
const SentBattlePreviewMessage = await Send({

content: `||${User}||`,
embeds: [
new EmbedBuilder()
.setTitle(DomainData.name)
.setFields([ // <- this line
const SentBattlePreviewMessage = await Send({

content: `||${User}||`,
embeds: [
new EmbedBuilder()
.setTitle(DomainData.name)
.setFields([ // <- this line
i logged the array i pass into .setFields logged result: https://pastebin.com/9ymjsc78 i am assuming the
{
name: "__Enemies__",
value: ...
}
{
name: "__Enemies__",
value: ...
}
field exceeds the length for embed fields but i wish the error could've done its job and actually told me the error
2 replies
DIAdiscord.js - Imagine an app
Created by potsu on 11/13/2022 in #djs-questions
how to fetch an array of users using an array of user ids? (from user manager not guild member)
is it not possible
18 replies
DIAdiscord.js - Imagine an app
Created by potsu on 10/23/2022 in #djs-questions
why set event return type to void instead of any?
Client.on("messageCreate", async (Message) => {
let isWrongAns = ...

if (isWrongAns) return await Message.channel.send("wrong answer");
})
Client.on("messageCreate", async (Message) => {
let isWrongAns = ...

if (isWrongAns) return await Message.channel.send("wrong answer");
})
typescript error (simplified):
the "messageCreate" event's expected return type is Promise<void>. But since you are returning a Message, i am giving you this error
the "messageCreate" event's expected return type is Promise<void>. But since you are returning a Message, i am giving you this error
i didnt use typescript before djs v14 but why not set the type to Promise<any>? is there a specific reason
18 replies