SpikeHD / AmazonMonitor

Amazon price checker, item monitor and stock monitor, all shoved into a Discord bot
GNU General Public License v3.0
235 stars 39 forks source link

DiscordAPIError: Cannot send an empty message #82

Closed YushenH closed 2 years ago

YushenH commented 2 years ago

Hi Sir, thanks for develop the tool and shared with us. I got some issues while using the bot. Please help

{ "prefix":"!", "token":"XXX", "minutes_per_check":2, "search_response_ms": 30000, "url_params":{}, "guild_item_limit":20, "cache_limit": 10, "required_perms":["SEND_MESSAGES", "ADMINISTRATOR"], "tld":"com", "auto_cart_link":true, "debug_enabled":false }


Above is the JS file.
I have added the bot to my discord server, it works for !help, however, when I use details, watch commands (did not try others) it would display BOT typing and in the shell, it throws error and quit.

Bellow is the detailed error

C:\Program Files\AmazonMonitor-master\node_modules\discord.js\src\rest\RequestHa
ndler.js:154
      throw new DiscordAPIError(request.path, data, request.method, res.status);

            ^

DiscordAPIError: Cannot send an empty message
    at RequestHandler.execute (C:\Program Files\AmazonMonitor-master\node_module
s\discord.js\src\rest\RequestHandler.js:154:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (C:\Program Files\AmazonMonitor-master\node_mod
ules\discord.js\src\rest\RequestHandler.js:39:14) {
  method: 'post',
  path: '/channels/935699559542325261/messages',
  code: 50006,
  httpStatus: 400
}

Node.js v17.4.0

Thanks in advance
SpikeHD commented 2 years ago

Weird! What do your full commands look like?

Eg: !watch -l https://amazon.com/dp/ABCD1234

YushenH commented 2 years ago

I can get watchlist, unwatch back normally as well. But cannot add to monitor, the commands I used is !watch -l https://www.amazon.com/dp/B07DLWM1JQ Bellows are screenshots. Thanks for helping me. image

image

SpikeHD commented 2 years ago

Can you show the console output with debug enabled?

YushenH commented 2 years ago

Thanks for the reply. I am not sure if this helped

image

SpikeHD commented 2 years ago

No worries! Did you set the debug flag properly? It should only look like:

“debug_enabled”: true

if you have, it should spit out a BUNCH of messages right when it starts up

YushenH commented 2 years ago

I just googled and get the bellow output, not sure if that's the one you need

image

image

SpikeHD commented 2 years ago

Nono, it just needs to be set to true in your config.json :)

YushenH commented 2 years ago

Oh I see, my bad

image

SpikeHD commented 2 years ago

Looks like your json is a bit funky now. Make sure there is a comma at the end of the debug_enabled line. Paste it into an online JSON validator if you have troubles

YushenH commented 2 years ago

You are right, but there is comma at the end

image

SpikeHD commented 2 years ago

OHHHH that makes sense, remove the comma and it should work. Didn’t realize you had it on the last line!

YushenH commented 2 years ago

Cool, the debuger works now image

SpikeHD commented 2 years ago

Awesome! I think I may have found a better lead, I will get back to you the next time I have time to work on this bug!

YushenH commented 2 years ago

Cool, thanks alot for your help and time.

SpikeHD commented 2 years ago

I believe I may have fixed what this was being caused by. Let me know if you still have issues!

YushenH commented 2 years ago

I believe I may have fixed what this was being caused by. Let me know if you still have issues!

thanks alot