Asgarrrr / Luna

An adorable discord bot fully customizable created in javascript, using Discord.js and mongoDB that is constantly growing !
https://lunadoc.vercel.app/
GNU General Public License v3.0
24 stars 3 forks source link

DiscordAPIError: Cannot send an empty message #18

Closed MilkFlavor closed 3 years ago

MilkFlavor commented 3 years ago

DiscordAPIError: Cannot send an empty message at RequestHandler.execute (/home/user/Documents/Luna-master/node_modules/discord.js/src/rest/RequestHandler.js:154:13) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:94:5) at async RequestHandler.push (/home/user/Documents/Luna-master/node_modules/discord.js/src/rest/RequestHandler.js:39:14) { method: 'post', path: '/channels/804408907354734682/messages', code: 50006, httpStatus: 400 }

This is fairly common

Asgarrrr commented 3 years ago

Mhhh You would have more details on how it happens ?

MilkFlavor commented 3 years ago

Oh, I was trying to find out what happens as well. This mostly happens when my friends and I type regularly. However, I searched in most scripts to see that maybe the bot was sending an empty embed or something. I think this happens because I don't use a prefix, but I doubt that.

Asgarrrr commented 3 years ago

I've never had this problem until now :/

MilkFlavor commented 3 years ago

lol damn this is weird... I'm going to trouble shoot a bit more. Just to see if it's something on my side.

Asgarrrr commented 3 years ago

Nice, maybe look at the level of the bot's permits? When you use too much a command, a message is sent with the cooldown, maybe that ?

MilkFlavor commented 3 years ago

I think you're on the right track, this only happens if you spam or if multiple people are talking at the same time. However, I did a bit of searching and I narrowed it down to the events folder. (or more specifically messages.js) Meaning: I don't get an error if I delete the message.js script but, tbh this error doesn't really affect the bot's performance directly as it only clouds up the console/terminal.

MilkFlavor commented 3 years ago

I also found a quick and dirty way:

delete this line in Luna.js

process.on("unhandledRejection", (err) => { console.error(err); }); But I don't recommend it.

Asgarrrr commented 3 years ago

Unfortunately, no longer seeing an error does not correct it ;(

MilkFlavor commented 3 years ago

I mean your code does work, it's just a warning I get in the terminal. Nothing else

Asgarrrr commented 3 years ago

Haha I know ;3

MilkFlavor commented 3 years ago

What is "setlog.js" supposed to do? becuase: TypeError: this.client.resolveChannel is not a function it's the same problem as the avatar and unban stuff

Asgarrrr commented 3 years ago

Rhaaa x) "Je suis débile"

MilkFlavor commented 3 years ago

Oh, est ce que tu es français? Je connais un peu le français

Asgarrrr commented 3 years ago

Oui, je le suis ;3

Asgarrrr commented 3 years ago

Et merci, vous me faites découvrir de nouveaux problèmes !

MilkFlavor commented 3 years ago

C'est bon, je n'aime pas française parce qu je travaille en anglais

MilkFlavor commented 3 years ago

Et merci, vous me faites découvrir de nouveaux problèmes !

merci

Asgarrrr commented 3 years ago

I can continue in English ;3

MilkFlavor commented 3 years ago

Wait are you updating the git hub respiratory or are you updating your personal?

I can continue in English ;3

thanks lol

MilkFlavor commented 3 years ago

Et merci, vous me faites découvrir de nouveaux problèmes !

I wasn't called "the problem child" by parents for nothing... ;-;

Asgarrrr commented 3 years ago

There I work locally, and as I finish (soon) PUSH!

MilkFlavor commented 3 years ago

Oh, sweet! I'll wait for the next release then.

Asgarrrr commented 3 years ago

HOP

MilkFlavor commented 3 years ago

Hey, did you find a fix to the problem yet?

Asgarrrr commented 3 years ago

Hello! As far as I don't have the problem on my side, I confess that I don't :( I'm doing a big cleanup and start again on a good base, I have work on the side that eats me up all my time :(

MilkFlavor commented 3 years ago

I'm sorry for bothering you when you're so busy. I'm not too good at programming myself, but I really like the notes you place in the code so I use it to learn. I could heard you're working locally, could you update the respiratory? Oh, and cleaning up from the base sounds like a great idea