#Show your code please

1 messages · Page 1 of 1 (latest)

hard locust
indigo vale
#

You're editing a non-existent reply?

hard locust
#

It's properly defered as promised.

#

Line 401 sends you to the first file

indigo vale
#

What are you trying to edit

hard locust
#

The defered interaction

indigo vale
#

You're just editing a reply that doesn't exist

hard locust
#

Because this thing worked for a year.

indigo vale
hard locust
indigo vale
#

Interaction* my bad

hard locust
#

Is defering not treated as a reply?

indigo vale
#

It is.. But you're not replying anything

hard locust
#

I reply in the end

indigo vale
#

No you're editing the reply

#

that doesn't exist

hard locust
#

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

indigo vale
#

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 waitWhat

hard locust
#

Because I cannot guarantee it takes 4 seconds

#

For ping I can

#

For other commands I cannot

#

So deferReply is illegal now?

indigo vale
#

What are you trying to do

hard locust
#

Then edit it

#

It works, but the edit doesn't

indigo vale
#

That's just discord sending a message like "Yo the bot has received your interaction it's now processing it"

hard locust
#

Yes

#

I want to process it

indigo vale
hard locust
#

With .editReply

#

Wym you can't?

#

How do I let the user know I finished processing it?

indigo vale
#

Just use interaction.reply({}) in your code, no reason to edit a non-existent thing

hard locust
#

DiscordAPIError[50006]: Cannot send an empty message

#

Which is not surprising for me

indigo vale
#

Add content to the message then

hard locust
#

I don't have a content to add to the message until I finish my calculations

indigo vale
#

That's why you put interaction.reply({}) at the end of your code?

hard locust
#

I don't

indigo vale
#

Man if you're refusing to learn I can't help you

hard locust
#

I'm trying to make the mechanism of "Deferred replies" work again

#

Not trying to send empty replies

indigo vale
hard locust
indigo vale
#

I have not given you any code

indigo vale
#

Ofcourse you can't reply with nothing

hard locust
#

I want to defer, then edit it.

coarse swiftBOT
hard locust
#

await interaction.deferReply({ ephemeral: true }).catch(() => null);

interaction.editReply({embeds: [embed], ephemeral: true})

#

Is this code not okay?

indigo vale
hard locust
#

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

indigo vale
#

then put the deferReply inside your user-ping.js command?

hard locust
#

Why?

indigo vale
#

Because you're trying to edit something that doesn't exist

hard locust
#
GitHub

Chess ELO Discord Bot. Contribute to eyal282/Chess-ELO-Discord-Bot development by creating an account on GitHub.

GitHub

Chess ELO Discord Bot. Contribute to eyal282/Chess-ELO-Discord-Bot development by creating an account on GitHub.

indigo vale
#

you need to deferReply inside your command code, not in interactionCreate

hard locust
#

Why does it matter?

#

I send that interaction to the code anyways

hard locust
#

But it's the same variable

#

It doesn't change

indigo vale
#

Go on and argue

hard locust
#

And if I do it it'll work?

indigo vale
#

Well try it

hard locust
#

It may give an error on the fact I'm deferring twice

indigo vale
#

remove the line in interactionCreate

#

And put it in your command code

hard locust
#

Won't work, won't give error

indigo vale
#

Show me your code

hard locust
#

Screenshare?

#

I'm using replit

indigo vale
#

You can just paste it in here

hard locust
#

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

indigo vale
hard locust
#

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?

indigo vale
#

You're not waiting anywhere..

hard locust
#

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?

indigo vale
hard locust
#

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

indigo vale
#

Also catching to null is never a great idea when debugging

hard locust
#

Do you want me to simplify it into an easier to understand?

indigo vale
#

Try just sending a string

#

Also catch into console.log instead of just voiding it

hard locust
#

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

indigo vale
#

I already told you lol

hard locust
# indigo vale ^

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

indigo vale
hard locust
#

I need you to concentrate on the issue

#

.editReply won't work

#

No errors

#

I removed the .catch, thanks for that, let's see...

weak matrix
#

I suspect you are getting ratelimited
If you use client.rest.on("rateLimited", console.log), do you get output?

hard locust
#

Again not working, no errors.

weak matrix
#

You didn't put it in any other listeners right?

hard locust
#

"ratelimited" yields 1 result across index.js and util.js

weak matrix
#

?

hard locust
# weak matrix ?

The word "rateLimited" does not appear anywhere on the code, except the one you sent me.

weak matrix
#

But did you put the rateLimited listener inside another listener?

#

like in a command

hard locust
#

Of course not lmaooo

#

That would break everything

weak matrix
#

And your debug logs have no 429s?

hard locust
#
; 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

weak matrix
#

Those are all the logs after the attempted editReply?

hard locust
#

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.

hard locust
#

Absolutely stuck, no solution. DJS is broken

weak matrix
#

Hmm

#

Could you put a log above the editReply, and below it
and make sure the editReply is awaited

hard locust
hard locust
#

It eventually edited the command

#

Took like 2 minutes until it worked

#

Why is this delay so massive?

weak matrix
#

There's no way you aren't ratelimited

hard locust
#

I really need a way to know if I'm rate limited.

weak matrix
#

debug and rateLimited events should be telling you

hard locust
#

They didn't :(

weak matrix
#

Could you show me the listeners

#

oh this looks like you're using replit blobsweats

#

99.9% sure it's a ratelimit

hard locust
#

Every second a bug shows up and disappears