'bot.login(token); Cannot read properties of undefined [closed]

I am new to coding in Discord.js and I have a problem. writes to me the error is the line that contains bot.login(token);

Could you tell me my mistake and explain how to fix it? thank you in advance.

ReferenceError: Cannot read properties of undefined (reading 'login')
at Object.<anonymous> (D:\Neneng\a) Neneng_Pribadi File\2] Raynar abiyu 
diera\Raynar\Raynar (1)\Ray's MC\Discord BOT\index.js:34:9)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155: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:77:12)
at node:internal/main/run_main_module:17:47

here is the code itself:

https://pastebin.com/LVL4j6MU


Solution 1:[1]

Your issue is a simple typo.

const embed = new MessageEmbed().
 
    bot.login(token);

That trailing period at the end of the first above line is causing your issue, as your code is now trying to do new MessageEmbed().bot.login(token) instead of just bot.login(token). And obviously, there is no bot property on message embeds, which causes you to get your undefined error.

Replace the period with a semicolon, or remove it, and this error will be fixed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cannicide