FoxCraftGaming

Untitled

Apr 2nd, 2021 (edited)
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. Code
  2.  
  3. const discord = require("discord.js");
  4. const botConfig = require("./botconfig.json");
  5.  
  6. const client = new discord.Client();
  7. client.login(botConfig.token);
  8.  
  9. client.on("ready", async () => {
  10.  
  11. console.log(`${client.user.username} is online`);
  12. client.user.setActivity("!help", {type: "Playing"});
  13.  
  14. });
  15.  
  16. client.on("message", async message =>{
  17.  
  18. if(message.author.bot) return;
  19.  
  20. if(message.channel.type == "dm") return;
  21.  
  22. var prefix = botConfig.prefix;
  23.  
  24. var messageArray = mesage.content.spit(" ");
  25.  
  26. var command = messageArray[0];
  27.  
  28. if(command === `${prefix}hallo`){
  29. return message.channel.send("Hoi!");
  30. }
  31.  
  32. });
  33.  
  34.  
  35. Error:
  36.  
  37. (node:28364) UnhandledPromiseRejectionWarning: ReferenceError: mesage is not defined
  38. at Client.<anonymous> (A:\Discord_Bot\bot\index.js:22:24)
  39. at Client.emit (events.js:315:20)
  40. at MessageCreateAction.handle (A:\Discord_Bot\bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
  41. at Object.module.exports [as MESSAGE_CREATE] (A:\Discord_Bot\bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
  42. at WebSocketManager.handlePacket (A:\Discord_Bot\bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
  43. at WebSocketShard.onPacket (A:\Discord_Bot\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
  44. at WebSocketShard.onMessage (A:\Discord_Bot\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
  45. at WebSocket.onMessage (A:\Discord_Bot\bot\node_modules\ws\lib\event-target.js:132:16)
  46. at WebSocket.emit (events.js:315:20)
  47. at Receiver.receiverOnMessage (A:\Discord_Bot\bot\node_modules\ws\lib\websocket.js:825:20)
  48. (Use `node --trace-warnings ...` to show where the warning was created)
  49. (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)
  50. (node:28364) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are
  51. not handled will terminate the Node.js process with a non-zero exit code.
Add Comment
Please, Sign In to add comment