feelfeel2008
feelfeel2008
DIAdiscord.js - Imagine an app
Created by TechSupport on 6/24/2024 in #djs-questions
Running commands asynchronously
Never mind I thought he was talking about python, still same thing with JavaScript. When I get back to my computer I’ll change python to JavaScript
33 replies
DIAdiscord.js - Imagine an app
Created by TechSupport on 6/24/2024 in #djs-questions
Running commands asynchronously
Worker threads can only run asynchronously in c and c++ but it is. More agreed upon to save resources by using asynchronous programming ie using await and async
33 replies
DIAdiscord.js - Imagine an app
Created by TechSupport on 6/24/2024 in #djs-questions
Running commands asynchronously
In python it is impossible to use multiple threads at once your only using one thread at a time even if you are utilizing more then one thread this is a simple fix to your problem but in the long term will probably not be efficient. If you need to scrape 50 to 100 websites you should use asynchronous programming with many threads to maximize your performance but then make a worker thread to run a function that uses asynchronous programming to fetch data. If you are not already get familiar with async and await + the threading library (python). If you need any more help feel free to reply.
33 replies
DIAdiscord.js - Imagine an app
Created by electric on 6/25/2024 in #djs-questions
How do I fix this problem? :)
It tells you what to do…
7 replies
DIAdiscord.js - Imagine an app
Created by feelfeel2008 on 6/19/2024 in #djs-questions
DiscordAPIError[10062]
Apologies for the confusion. The issue arises when I send the deferred reply message to Discord; a three-second interaction timeout occurs before Discord receives the deferred reply. Consequently, instead of showing "thinking," the application displays "the application did not respond." This indicates that Discord never received the deferred reply due to the timeout.
18 replies
DIAdiscord.js - Imagine an app
Created by feelfeel2008 on 6/19/2024 in #djs-questions
DiscordAPIError[10062]
The default for a rest discord interaction is 3 seconds, that’s why if your processing something that takes longer then 3 seconds you use interaction.deferreply() that gets you an extra 15 minutes to process. My problem (and maybe yours) is that my internet is so slow that I can even send the deferreply to discord in time.
18 replies
DIAdiscord.js - Imagine an app
Created by feelfeel2008 on 6/19/2024 in #djs-questions
DiscordAPIError[10062]
i see. thanks!
18 replies
DIAdiscord.js - Imagine an app
Created by feelfeel2008 on 6/19/2024 in #djs-questions
DiscordAPIError[10062]
it does not get used at all. just added that to expand to other files when needed. is this a bad practice?
18 replies
DIAdiscord.js - Imagine an app
Created by feelfeel2008 on 6/19/2024 in #djs-questions
DiscordAPIError[10062]
ill maybe try it on another computer and see if that helps. thanks for confirming.
18 replies
DIAdiscord.js - Imagine an app
Created by feelfeel2008 on 6/19/2024 in #djs-questions
DiscordAPIError[10062]
no the bot never defers the command it does get to the point where it does defer it but i think it takes to long resulting in the bot crashing when the deferd response reaches discord.
18 replies
DIAdiscord.js - Imagine an app
Created by feelfeel2008 on 6/19/2024 in #djs-questions
DiscordAPIError[10062]
And here's the error I'm encountering: logged in! Bot is ready! i got the command 1252684797470445661 node:events:496 throw er; // Unhandled 'error' event ^ DiscordAPIError[10062]: Unknown interaction at handleErrors (/home/felix/projects/basic_Discord_Bot/node_modules/@discordjs/rest/dist/index.js:730:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async BurstHandler.runRequest (/home/felix/projects/basic_Discord_Bot/node_modules/@discordjs/rest/dist/index.js:835:23) at async _REST.request (/home/felix/projects/basic_Discord_Bot/node_modules/@discordjs/rest/dist/index.js:1278:22) at async ChatInputCommandInteraction.deferReply (/home/felix/projects/basic_Discord_Bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:71:5) at async Client.<anonymous> (/home/felix/projects/basic_Discord_Bot/src/app.js:24:5) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:401:10) at process.processTicksAndRejections (node:internal/process/task_queues:84:21) { requestBody: { files: undefined, json: { type: 5, data: { flags: undefined } } }, rawError: { message: 'Unknown interaction', code: 10062 }, code: 10062, status: 404, method: 'POST', url: 'https://discord.com/api/v10/interactions/1252684797470445661/aW50ZXJhY3Rpb246MTI1MjY4NDc5NzQ3MDQ0NTY2MTp5UkVhWFNqeHNieFZqQUhMakFPTWNiUGtFS2RQc3Z6OWlSUms1aDB1OFFLa1ZnMUpZUDFKbHFmeU9HMlBuajBUNWhPTzV3NlZnQTd2bTRqUHdtTXhzT3NRYnIzeDdPeFBoOGdZc2VuVUhLdEZFeEJQSUcwdms1SlpUNTFKVlgxWg/callback' } Node.js v20.12.2
18 replies
DIAdiscord.js - Imagine an app
Created by feelfeel2008 on 6/19/2024 in #djs-questions
DiscordAPIError[10062]
const {Client, IntentsBitField, Message,} = require("discord.js")
require('dotenv').config();
const resolve_command = require("./interaction-handler.js")


const client = new Client({
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent,
]});


module.exports = client

client.on("ready", () => {
console.log("Bot is ready!");
});

client.on("interactionCreate" , async (interaction) => {
console.log("i got the command")
console.log(interaction.id)
await interaction.deferReply()
console.log("deferdf reply")

if (!interaction.isChatInputCommand()) return;

resolve_command(interaction)

console.log("i have been finished")

await interaction.editReply("hi i gueesss")

console.log("sent the command")




})

client.login(process.env.DISCORD_BOT_TOKEN)
console.log("logged in!")
const {Client, IntentsBitField, Message,} = require("discord.js")
require('dotenv').config();
const resolve_command = require("./interaction-handler.js")


const client = new Client({
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent,
]});


module.exports = client

client.on("ready", () => {
console.log("Bot is ready!");
});

client.on("interactionCreate" , async (interaction) => {
console.log("i got the command")
console.log(interaction.id)
await interaction.deferReply()
console.log("deferdf reply")

if (!interaction.isChatInputCommand()) return;

resolve_command(interaction)

console.log("i have been finished")

await interaction.editReply("hi i gueesss")

console.log("sent the command")




})

client.login(process.env.DISCORD_BOT_TOKEN)
console.log("logged in!")
18 replies