簡體   English   中英

client.guilds.find 不是 function

[英]client.guilds.find is not a function

嗨,我已經獲得了一個在 discord 上工作的機器人,這需要一堆依賴項來幫助它運行。

所以我打電話給他們,結果如下。

最后一件事是調用“forever -o out.log bot.js”來運行機器人並再次得到以下結果。 我對這一切仍然很陌生,但它似乎無法調用應該在 discord.js 中的 function。 如果是這樣,有人可以解釋為什么會這樣,特別是如果我在運行機器人之前調用了它。 任何幫助將不勝感激。

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
Kevins-Air:PDL_Season_4 kev$ npm install discord.io winston --save
npm WARN kev@1.0.0 No description
npm WARN kev@1.0.0 No repository field.

+ winston@3.2.1
+ discord.io@2.5.3
updated 2 packages and audited 305 packages in 5.017s

31 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
Kevins-Air:PDL_Season_4 kev$ npm install discord.js
npm WARN kev@1.0.0 No description
npm WARN kev@1.0.0 No repository field.

+ discord.js@12.2.0
updated 1 package and audited 305 packages in 2.738s

31 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
Kevins-Air:PDL_Season_4 kev$ npm install https://github.com/woor/discord.io/tarball/gateway_v6
npm WARN kev@1.0.0 No description
npm WARN kev@1.0.0 No repository field.

+ discord.io@2.5.3
updated 1 package and audited 305 packages in 2.803s

31 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
Kevins-Air:PDL_Season_4 kev$ npm install googleapis
npm WARN kev@1.0.0 No description
npm WARN kev@1.0.0 No repository field.

+ googleapis@39.2.0
updated 1 package and audited 305 packages in 4.529s

30 packages are looking for funding
  run `npm fund` for details

found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
Kevins-Air:PDL_Season_4 kev$ npm install forever -g
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
/Users/kev/.npm-packages/bin/forever -> /Users/kev/.npm-packages/lib/node_modules/forever/bin/forever
+ forever@3.0.0
updated 1 package in 8.677s
Kevins-Air:PDL_Season_4 kev$ forever -o out.log bot.js
warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
Authentication set.

PokeDraftBotBeta running...

Loading Servers...

Loading Server: PDL Season 4

(node:1554) UnhandledPromiseRejectionWarning: TypeError: client.guilds.find is not a function
    at /Users/kev/Desktop/PDL_Season_4/bot.js:1204:37
    at new Promise (<anonymous>)
    at LoadServerObject (/Users/kev/Desktop/PDL_Season_4/bot.js:1201:10)
    at InitializeServers (/Users/kev/Desktop/PDL_Season_4/bot.js:1152:27)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1554) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1554) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

在 v12 中,client.guilds 是 GuildsManager,它曾經是一個集合,但該集合已移至client.guilds.cache

所以總而言之,只需更改client.guilds.find => client.guilds.cache.find

你也應該在未來標記 discord.js

Client.guilds返回沒有 function findGuildsManager 你到底想做什么?

順便說一句,您的依賴項中存在安全漏洞,請按照日志中的說明運行npm audit fix

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM