args.split is not a function
Heyo! I tryed, but my terminal says:
UnhandledPromiseRejectionWarning: TypeError: args.split is not a function
Here is the complete error:
C:\Users\Erwan\Documents\Bureau2\bot>node index.Js eval.js loaded! eval2.js loaded! example.js loaded! help-utils.js loaded! help.js loaded! remind.js loaded! On a passé l'étape du status BeerTheBear is online. (node:5380) UnhandledPromiseRejectionWarning: TypeError: args.split is not a function at Object.module.exports.run (C:\Users\Erwan\Documents\Bureau2\bot\commands\remind.js:13:29) at Client.<anonymous> (C:\Users\Erwan\Documents\Bureau2\bot\index.Js:54:31) at Client.emit (events.js:315:20) at MessageCreateAction.handle (C:\Users\Erwan\Documents\Bureau2\bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14) at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Erwan\Documents\Bureau2\bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (C:\Users\Erwan\Documents\Bureau2\bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31) at WebSocketShard.onPacket (C:\Users\Erwan\Documents\Bureau2\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22) at WebSocketShard.onMessage (C:\Users\Erwan\Documents\Bureau2\bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10) at WebSocket.onMessage (C:\Users\Erwan\Documents\Bureau2\bot\node_modules\discord.js\node_modules\ws\lib\event-target.js:132:16) at WebSocket.emit (events.js:315:20) (node:5380) 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:5380) [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.
and here is the command's code:
`const Discord = require('discord.js') const client = new Discord.Client() const commando = require('discord.js-commando'); const moment = require('moment');
module.exports.run = async (bot, message, args) => { //this is where the actual code for the command goes
let splitMessage = args.split(' ');
var filteredMessage = args.replace(splitMessage[0], '');
function reminder() {
message.reply("\n**REMINDER:**\n" + filteredMessage);
}
switch(splitMessage[0].slice(-1)) {
case 's': {
var msDelay = splitMessage[0].slice(0, -1) * 1000;
message.reply("Your reminder has been set. I will remind you in " + splitMessage[0].slice(0, -1) + "seconds.");
setTimeout(reminder, msDelay);
break;
}
case 'm': {
var msDelay = splitMessage[0].slice(0, -1) * 60000;
message.reply("Your reminder has been set. I will remind you in " + splitMessage[0].slice(0, -1) + "minutes.");
setTimeout(reminder, msDelay);
break;
}
case 'h': {
var msDelay = splitMessage[0].slice(0, -1) * 3600000;
message.reply("Your reminder has been set. I will remind you in " + splitMessage[0].slice(0, -1) + "hours.");
setTimeout(reminder, msDelay);
break;
}
case 'd': {
var msDelay = splitMessage[0].slice(0, -1) * 86400000;
message.reply("Your reminder has been set. I will remind you in " + splitMessage[0].slice(0, -1) + "days.");
setTimeout(reminder, msDelay);
break;
}
}
}
//name this whatever the command name is. module.exports.help = { name: "remind" } `
Hopefully you can help me! Apreciate ya.