#Using nextjs to post message with Webhook (timers promises error)

4 messages · Page 1 of 1 (latest)

static flower
#

Hi, is it not possible to use a nextjs web app and discord.js to use a webhook to post a message to a channel?
I am getting an error which is related to timers/promises:

./node_modules/@discordjs/rest/dist/index.js:282:0
Module not found: Can't resolve 'timers/promises'

Import trace for requested module:
./node_modules/discord.js/src/index.js
./components/functions/general/discordWebhook.ts
./components/ui/FeedbackButton.tsx
./pages/dstake/[token].tsx

https://nextjs.org/docs/messages/module-not-found
versed galleon
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

static flower
#

importing the webhook like it is shown as example:

import { EmbedBuilder, WebhookClient } from "discord.js";

export default class DiscordWebhook {
  constructor() {
    this.client = new WebhookClient({ url: discordWebhookUrl });
  }...