Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
Simple Webhook code 'shardCount' on string error?

I trying to make and start learning to code a bid with API's But I have this really annoying error... My code is

    const Discord = require('discord.js')
    const webhookID = '888151030620106792'; 
    const webhookToken = 'token-here';
    
    
    const webhook = new Discord.WebhookClient(webhookID, webhookToken);



    webhook.send('I am here')

And The error i get out if it is:

PS C:\Users\jonat\Desktop\Api Dev\Discord and Rest Api> node webhooks.js
C:\Users\jonat\Desktop\Api Dev\Discord and Rest Api\node_modules\discord.js\src\util\Util.js:336
        given[key] = def[key];
                   ^

TypeError: Cannot create property 'shardCount' on string 'zFutoKYe-OfZrfPdh0UE5yCk2wMOe-B84Xcs_Af6a76DXTx6bt3WB48qZwH-KvUriqtI'

    at Function.mergeDefault (C:\Users\jonat\Desktop\Api Dev\Discord and Rest Api\node_modules\discord.js\src\util\Util.js:336:20)
    at new BaseClient (C:\Users\jonat\Desktop\Api Dev\Discord and Rest Api\node_modules\discord.js\src\client\BaseClient.js:20:25)
    at new WebhookClient (C:\Users\jonat\Desktop\Api Dev\Discord and Rest Api\node_modules\discord.js\src\client\WebhookClient.js:26:5)
    at Object.<anonymous> (C:\Users\jonat\Desktop\Api Dev\Discord and Rest Api\webhooks.js:9:25)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)     
    at node:internal/main/run_main_module:17:47

I Get the same error when I do this:

const Discord = require('discord.js');

const webhook = new WebhookClient('888151030620106792', 'zFutoKYe-OfZrfPdh0UE5yCk2wMOe-B84Xcs_Af6a76DXTx6bt3WB48qZwH-KvUriqtI')

  
webhook.send('Hello World;)')`
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

const discord = require('discord.js');
const data = {
    id: 'idhere',
    token: 'tokenhere'
}
const webhook = new discord.WebhookClient(data);
webhook.send('hello');

I was having this issue as well today but by sending the webhook data as an object worked for me, hope this helps 👍

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda