簡體   English   中英

歡迎不和諧消息

[英]Welcome Discord Message

所以我嘗試在歡迎消息中添加一條嵌入消息,當我按下npm run它指出存在錯誤,錯誤如下所述。 文件被命名為welcome.py

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

bot.on('guildMemberAdd', member => {
    const exampleEmbed = new Discord.RichEmbed()
        .setColor('#2f3136')
        .setTitle('Welcome to miyoko.')
        .setImage("https://media.discordapp.net/attachments/891480598680600608/893855953831743508/image0.jpg")
        .setThumbnail("https://cdn.discordapp.com/icons/891338757972840458/603efa60b46e5dd8b09aafeaf8167c5c.webp")
        .setDescription('<:asc_bhrttt:893064714735726622> <#892951925270642739> \n <:ra_xheart01:893064647698178069> <#892953158299582484> \n <:ra_xheart02:893065191170924544> <#892954010993164308')

    member.guild.channels.get('891480598680600608').send(exampleEmbed);
})
Error: Cannot find module 'node:events'
Require stack:
- /home/runner/welc-hyewon/node_modules/discord.js/src/client/BaseClient.js
- /home/runner/welc-hyewon/node_modules/discord.js/src/index.js
- /home/runner/welc-hyewon/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/runner/welc-hyewon/node_modules/discord.js/src/client/BaseClient.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)H

您使用的是哪個 node.js 版本? 看起來您使用的是舊的 node.js 版本。 使用node -v檢查。 你可以在這里下載最新的 node.js 版本: https : //nodejs.org/en/download/current/

暫無
暫無

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

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