#Discord slash command(s) deleting itself. (Sorry closed last post too early)

70 messages · Page 1 of 1 (latest)

royal wolf
#

Hi.

Sorry, I marked my last post as solved too early.

I cannot figure out why when the bot launches and the slash commands are re-added, after the first-use of each command, they just disappear.

For one of the commands, I do get an error attempting to call it a second time, "The reply to this interaction has not been sent or deferred.", but not the other one, it just deletes.

Does anybody have any ideas?

lofty skyBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
royal wolf
#

quick update: It looks like it is just the bump command now

worthy sparrow
#

What do you mean „re-added“? Do you delete all commands and then deploy them on each reboot?

royal wolf
#

My "registerCommands" method should not fire unless there is a new command

worthy sparrow
#

„Should not“ or „does not“?

royal wolf
#

should not

#

here is the code for it

worthy sparrow
#

Since you do have a console.log there that happens if it deploys I don’t have to look at the code at all. You should be able to tell me if it runs on your restart. Not just hypothetically if it should not run

royal wolf
#

Yeah

#

It works as intended

#

I just sort of scrapped it up, so I wasn't sure

#

I was told in my previous post that it "shouldn't" be related to the commands registering anyways

worthy sparrow
#

Well, if you delete and redeploy commands on restart of your bot it would be related to that

royal wolf
#

I have no idea at this point. When "/bump" is fired, it deletes itself and the one other public command. When the other command is fired, I think it works continuously as intended, but deletes "/bump"

royal wolf
worthy sparrow
worthy sparrow
royal wolf
#

Removed the try/catch, thank you for catching that

worthy sparrow
# royal wolf

That’s still not the full catch block. That part I could already see in your OP

royal wolf
#

Oh pfff

#

My bad

#

How's that

#

I tried to fit it as best as I could lol

worthy sparrow
#

Worse… i want the full catch block. Not the try part

royal wolf
#

I'm confused on what you mean by the "full" catch block

#

Sorry

royal wolf
worthy sparrow
#

As in what does your code do when it catches something that isn’t an instanceof BotError

royal wolf
#

I mean

#

That was literally it

#

lol

worthy sparrow
#

So… nothing?

#

Not even log it?

royal wolf
#

true I guess..

#

jesus im tired

#

let me try

#

i swear to you i'm not an idiot, just tired 😭

worthy sparrow
#

Discord throws different errors (DiscordjsError and DiscordAPIError), maybe one of those happens and could explain or at least help find your issue

worthy sparrow
royal wolf
#

I can't recall if const { guild } = interaction; is actually correct or not

worthy sparrow
#

It is, but you seem to not pass anything to that function (hence interaction is undefined)

royal wolf
#

oh my god wait whoops

#

a few minutes ago I accidentally deleted the command.execute function

#

ugh

#

retrying

#

This is the only output I see.

#

I forgot to mention I am using sharding

#

I just set it up to have it there

worthy sparrow
#

BadRequestError sounds worth investigating

#

Oh god, it’s sharding on deno? No idea how/if that works

royal wolf
royal wolf
#

Sent when the bot errors something like this (it errored correctly)

worthy sparrow
#

But why is there a fastify between your handler and your bump command in the stacktrace?

royal wolf
#

I'm using docker and I ran the "bot" and "api" container.

Fastify is coming from the API container (which is also logging the error class), and the bot is just logging, I think.

I don't know why they are mixed up like that.

worthy sparrow
#

That sounds like an issue indeed then. How are bot and API connected exactly? Since you mentioned sharding it would be horrible if all shards connected with the same API directly (not through a socket) and thus ended up in the same process somehow

royal wolf
#

I see what you mean though, but I don’t think each shard would technically connect to the API, just send requests.

#

I do have a feeling the issue might be shard-related, but I am still not sure. I only added the bump command and the shard manager before this started happening. I have no idea what the fix is.