Bot crashes: invalid webhook token

Hi my bot crashes after running a command that takes about 15 minutes to finish? The command updates the message according to the 'game state'.

this is the error code
error: Uncaught (in promise) DiscordAPIError[50027]: Invalid Webhook Token
    at handleErrors (file:///C:/Users/Jurn Wubben/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/rest/2.4.0/dist/index.js:727:13)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async SequentialHandler.runRequest (file:///C:/Users/Jurn Wubben/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/rest/2.4.0/dist/index.js:1128:23)
    at async SequentialHandler.queueRequest (file:///C:/Users/Jurn Wubben/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/rest/2.4.0/dist/index.js:959:14)
    at async _REST.request (file:///C:/Users/Jurn Wubben/AppData/Local/deno/npm/registry.npmjs.org/@discordjs/rest/2.4.0/dist/index.js:1272:22)
    at async InteractionWebhook.editMessage (file:///C:/Users/Jurn Wubben/AppData/Local/deno/npm/registry.npmjs.org/discord.js/14.16.3/src/structures/Webhook.js:341:15)
    at async ButtonInteraction.editReply (file:///C:/Users/Jurn Wubben/AppData/Local/deno/npm/registry.npmjs.org/discord.js/14.16.3/src/structures/interfaces/InteractionResponses.js:162:17)
    at async file:///C:/Users/Jurn Wubben/Documents/DCBot/src/commands/utility/coc.ts:570:5


and it crashes in this part of the code
  const message = await interaction.reply({...clashMessage({
    handle: clash,
    langs,
    modes,
    players: [{ nickname: "loading..." }],
    started: false,
  }, interaction.user.id)});

  // message.startThread({
  //   name: "Clash of Code",
  //   reason: "Discuss your coc here."
  // })
  
  await clashEventManager(clash, async (data) => {
    await message.edit(clashMessage(data, interaction.user.id)); // CRASHES HERE
  });


the clahsEventManager is a function that runs the callback when there's a message received via socket.io

I'll also upload my full code later.
Was this page helpful?