#Show your code please
1 messages · Page 1 of 1 (latest)
You're editing a non-existent reply?
It's properly defered as promised.
Line 401 sends you to the first file
What are you trying to edit
The defered interaction
When I defer the interaction, what's the way to edit it then?
Because this thing worked for a year.
You reply to the message first (where the reply has content), then you can edit that
I'm not exactly following? What message?
Interaction* my bad
Is defering not treated as a reply?
It is.. But you're not replying anything
I reply in the end
The reply is the defer
This is why I used to get "Reply already sent or deferred" when using interaction.reply
await interaction.deferReply();
await wait(4000);
await interaction.editReply('Pong!');
This is basically what I'm doing
This is taken from DJS guide
I'll help ya out:
await interaction.reply({})
Then, in user-ping.js
interaction.editReply().
I don't understand why you're doing this though. Why don't you just reply in the user-ping.js 
Because I cannot guarantee it takes 4 seconds
For ping I can
For other commands I cannot
So deferReply is illegal now?
I'm trying to make this happen:
Then edit it
It works, but the edit doesn't
Well you can't edit that...?
That's just discord sending a message like "Yo the bot has received your interaction it's now processing it"
I'm trying, it won't work
Yes
I want to process it
No because you can't
With .editReply
Wym you can't?
How do I let the user know I finished processing it?
This is not your reply
Just use interaction.reply({}) in your code, no reason to edit a non-existent thing
Add content to the message then
I don't have a content to add to the message until I finish my calculations
That's why you put interaction.reply({}) at the end of your code?
I don't
Man if you're refusing to learn I can't help you
I'm trying to make the mechanism of "Deferred replies" work again
Not trying to send empty replies
why are you sending empty replies then
Where?
Here...
That's your code, not mine
I have not given you any code
^ That is incorrect
You have to fill in what you want to reply...
Ofcourse you can't reply with nothing
I want to defer, then edit it.
InteractionReplyOptions
Options for a reply to an [Interaction](<https://discord.js.org/#/docs/discord.js/stable/class/Interaction>).
await interaction.deferReply({ ephemeral: true }).catch(() => null);
interaction.editReply({embeds: [embed], ephemeral: true})
Is this code not okay?
Not for what you're trying to do
I want to "Chess ELO Role is thinking..."
And then, edit the "Chess ELO Role is thinking..." with my response.
How?
"Chess ELO Role is thinking..." works, but editing it won't work
then put the deferReply inside your user-ping.js command?
Why?
Because you're trying to edit something that doesn't exist
https://github.com/eyal282/Chess-ELO-Discord-Bot/blob/replit/index.js#L401
Line 401 will send you to https://github.com/eyal282/Chess-ELO-Discord-Bot/blob/replit/commands-ephemeral/user-ping.js
you need to deferReply inside your command code, not in interactionCreate
Go on and argue
And if I do it it'll work?
Well try it
It may give an error on the fact I'm deferring twice
Then don't defer twice
remove the line in interactionCreate
And put it in your command code
Won't work, won't give error
Show me your code
You can just paste it in here
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Lag of the Bot'),
async execute(client, interaction, settings, goodies) {
//let ephemeral = interaction.options.getBoolean('ephemeral');
let embed = undefined;
let row = undefined;
let attachment = undefined;
embed = new EmbedBuilder({
description: `🏓Latency is ${Date.now() -
interaction.createdTimestamp}ms. API Latency is ${Math.round(
client.ws.ping
)}ms\nBot is running for ${jsGay.getTimeDifference(
jsGay.bootDate,
new Date()
)}`
}).setColor(0x0099ff);
await interaction.deferReply({ ephemeral: true }).catch(() => null);
interaction.editReply({ embeds: [embed], ephemeral: true });
interaction.channel.send({ content: 'This is an embed' });
}
};
Once you give a working solution, I will ignore everything related to the .deferReply you said, and it'll work flawlessly, because it doesn't matter when I defer it, as long as I defer it.
But I guess it helps for debugging
What is the point of deferring a reply if you're not waiting inbetween it?
It makes no sense if it's done inside the code, but I'll write .deferReply many many many times
I simply put the deferReply outside the code block, because I ALWAYS defer it
Why won't it work?
You're not waiting anywhere..
Answer this question
This is for optimization of the code
But I cannot get this thing through your head, as you claim I'm editting a non deferred reply
I need to solve it.
Does it matter that I'm not waiting?
Yes...
Does not work
await interaction.deferReply({ ephemeral: true }).catch(() => null);
await wait(4000);
interaction.editReply({ embeds: [embed], ephemeral: true });
interaction.channel.send({ content: 'This is an embed' });```
The edit is clearly called after 4 seconds, as shown in the image
What is EmbedBuilder here?
Also catching to null is never a great idea when debugging
Do you want me to simplify it into an easier to understand?
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
As promised, you're pretending I didn't defer it in the original code, but I did.
I'll remove the deferReply you told me to add, because you're telling me to defer it twice, which is illegal

You told me to defer twice, you just didn't believe I deferred the first time, by telling me I'm "trying to reply to something that doesn't exist"
I had 1 defers
Whatever you think man, if you can't stand it when someone is helping you then tell me. If you don't understand what I'm saying then tell me
I need you to concentrate on the issue
.editReply won't work
No errors
I removed the .catch, thanks for that, let's see...
I suspect you are getting ratelimited
If you use client.rest.on("rateLimited", console.log), do you get output?
Again not working, no errors.
Unfortunately not.
You didn't put it in any other listeners right?
"ratelimited" yields 1 result across index.js and util.js
?
The word "rateLimited" does not appear anywhere on the code, except the one you sent me.
And your debug logs have no 429s?
; provide saveUninitialized option at util.js:32:9
Fontconfig error: Cannot load default config file
Example app listening at http://localhost:3000
Successfully unregistered guild application commands.
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 983
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 10
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
Successfully registered global application commands.
[WS => Shard 0] [CONNECTED] Took 1035ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 4611
[WS => Shard 0] [READY] Session 83d59c390beed8013834d74a138c7689 | Resume url wss://gateway-us-east1-b.discord.gg.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 1746ms.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
Chess ELO Role has been completely loaded and is ready to use
Chess ELO Role has been completely loaded and is ready to use
Chess ELO Role has been completely loaded and is ready to use
(node:5425) DeprecationWarning: isConnected is deprecated and will be removed in the next major version
(Use `node --trace-deprecation ...` to show where the warning was created)
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 49ms.
true
[WS => Shard 0] [HeartbeatTimer] Sending a heartbeat.
[WS => Shard 0] Heartbeat acknowledged, latency of 39ms.
I don't think
Those are all the logs after the attempted editReply?
No
a
(node:5425) DeprecationWarning: BaseInteraction#isSelectMenu() is deprecated. Use BaseInteraction#isStringSelectMenu() instead.
b
c
a is start of "interactionCreate"
b is before executing the command, going into the file of the command
c is complete excution of the file of the command
When c is printed, and it is, this file is completely properly done
and it's printed after 4 seconds
await wait(4000);
I really hate DJS
Why won't it edit the reply?
My DJS is 14.7.0 instead of 14.7.1
I'll update, sure.
Absolutely stuck, no solution. DJS is broken
Hmm
Could you put a log above the editReply, and below it
and make sure the editReply is awaited
There is, it's just on the interactionCreate.
Done, it stops at editReply
It eventually edited the command
Took like 2 minutes until it worked
Why is this delay so massive?
There's no way you aren't ratelimited
I'll kill the process then..
I really need a way to know if I'm rate limited.
debug and rateLimited events should be telling you
They didn't :(
Could you show me the listeners
oh this looks like you're using replit 
99.9% sure it's a ratelimit
Every second a bug shows up and disappears