Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code
- const discord = require("discord.js");
- const botConfig = require("./botconfig.json");
- const client = new discord.Client();
- client.login(botConfig.token);
- client.on("ready", async () => {
- console.log(`${client.user.username} is online`);
- client.user.setActivity("!help", {type: "Playing"});
- });
- client.on("message", async message =>{
- if(message.author.bot) return;
- if(message.channel.type == "dm") return;
- var prefix = botConfig.prefix;
- var messageArray = mesage.content.spit(" ");
- var command = messageArray[0];
- if(command === `${prefix}hallo`){
- return message.channel.send("Hoi!");
- }
- });
- Error:
- (node:28364) UnhandledPromiseRejectionWarning: ReferenceError: mesage is not defined
- at Client.<anonymous> (A:\Discord_Bot\bot\index.js:22:24)
- at Client.emit (events.js:315:20)
- at MessageCreateAction.handle (A:\Discord_Bot\bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
- at Object.module.exports [as MESSAGE_CREATE] (A:\Discord_Bot\bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
- at WebSocketManager.handlePacket (A:\Discord_Bot\bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
- at WebSocketShard.onPacket (A:\Discord_Bot\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
- at WebSocketShard.onMessage (A:\Discord_Bot\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
- at WebSocket.onMessage (A:\Discord_Bot\bot\node_modules\ws\lib\event-target.js:132:16)
- at WebSocket.emit (events.js:315:20)
- at Receiver.receiverOnMessage (A:\Discord_Bot\bot\node_modules\ws\lib\websocket.js:825:20)
- (Use `node --trace-warnings ...` to show where the warning was created)
- (node:28364) 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: 1)
- (node:28364) [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.
Add Comment
Please, Sign In to add comment