简单的 Webhook 代码'shardCount'字符串错误?



我试图使并开始学习与API的编码投标,但我有这个非常烦人的错误…我的代码是

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


const webhook = new Discord.WebhookClient(webhookID, webhookToken);

webhook.send('I am here')

和我得到的错误,如果是:

PS C:UsersjonatDesktopApi DevDiscord and Rest Api> node webhooks.js
C:UsersjonatDesktopApi DevDiscord and Rest Apinode_modulesdiscord.jssrcutilUtil.js:336
given[key] = def[key];
^
TypeError: Cannot create property 'shardCount' on string 'zFutoKYe-OfZrfPdh0UE5yCk2wMOe-B84Xcs_Af6a76DXTx6bt3WB48qZwH-KvUriqtI'
at Function.mergeDefault (C:UsersjonatDesktopApi DevDiscord and Rest Apinode_modulesdiscord.jssrcutilUtil.js:336:20)
at new BaseClient (C:UsersjonatDesktopApi DevDiscord and Rest Apinode_modulesdiscord.jssrcclientBaseClient.js:20:25)
at new WebhookClient (C:UsersjonatDesktopApi DevDiscord and Rest Apinode_modulesdiscord.jssrcclientWebhookClient.js:26:5)
at Object.<anonymous> (C:UsersjonatDesktopApi DevDiscord and Rest Apiwebhooks.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
当我这样做时,我得到同样的错误:
const Discord = require('discord.js');
const webhook = new WebhookClient('888151030620106792', 'zFutoKYe-OfZrfPdh0UE5yCk2wMOe-B84Xcs_Af6a76DXTx6bt3WB48qZwH-KvUriqtI')

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

我今天也有这个问题,但是通过发送webhook数据作为一个对象为我工作,希望这有助于👍