简体   繁体   中英

Welcome Discord Message

so i tried adding an embed message in the welcome message and as i pressed npm run it stated that there was an error the error is stated below. file is named as 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

What node.js version are you using? It looks like you are using an old node.js version. Use node -v to check. You can download the latest node.js version here: https://nodejs.org/en/download/current/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM