SpikeHD/AmazonMonitor

Error

Closed this issue · 3 comments

Hi

I can't get past the below error. Can you help
$ node index
node:internal/modules/cjs/loader:1170
throw err;
^

SyntaxError: C:\Users\ugur\Desktop\amazon\config.json: Unexpected token h in JSON at position 163
at parse ()
at Object.Module._extensions..json (node:internal/modules/cjs/loader:1167:22)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\ugur\Desktop\amazon\common\debug.js:2:27)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)

my config.json

{
"prefix":"!",
"token":"OTA2MTUxODU0NzYzODIzMTxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"minutes_per_check":2,
"search_response_ms": 30000,
"url_params":{https://www.amazon.com/PowerColor-Hellhound-Spectral-Graphics-Powered/dp/B094MM9X6S/ref=sr_1_2?keywords=6700xt&qid=1636109590&sr=8-2},
"guild_item_limit":5,
"cache_limit": 10,
"required_perms":["ADMINISTRATOR"],
"tld":"com",
"auto_cart_link":true,
"debug_enabled":enable
}

Your url_params are invalid. In the example, it states it's a list of key value pairs, like so:

{
    "param":"param_value"
}

and not like:

{ amazon link.com }

I think you're misunderstanding what that option is for, so for now I suggest you just leave it empty ({}). You do not add Amazon links in the JSON file, but instead by using the Discord bot's commands.

In the error text it says that it is related to the token. i deleted amazon link

Also, is there a bot you can recommend for the discord bot?

This is the discord bot. This code is everything you need to run a local instance, as it isn't possible to run a public instance.

The error text is actually related to the URL that you had put in before, which is not where you are supposed to put it. Below I have fixed your config.json:

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

I recommend using a JSON validator on your config when you make changes before you restart the bot.