I'm getting this error called UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
What did I do wrong here? I can't fix this error, I'm trying to make the bot that checks my DISCORD ID and then sends my "Note" where thats in the screenshot.
Here is a screenshot from my mongodb compass.
https://i.stack.imgur.com/rM98a.jpg
This is what I have in my function.
async function checkNotes() {
if(taggedUser !== undefined) {
var d = new Date;
function addZero(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
addZero(d.getMinutes());
var d = new Date();
var h = addZero(d.getHours());
var m = addZero(d.getMinutes());
dformat = [d.getFullYear(),
d.getMonth()+1,
d.getDate()].join('/');
const noted = new noteModel ({
_id: mdb.Types.ObjectId(),
Note: args.slice(1).join(' '),
User: taggedUser.username,
UserId: taggedUser.id,
getTime: dformat + " " + h + ":" + m
});
await noteModel.find({"UserId" : { $in : [noted.UserId]}});{
await message.channel.send(noted.Note)
}
}
else{
message.channel.send("Nem választottál ki senkit.")
}
}