Structure-Discord-Bot icon indicating copy to clipboard operation
Structure-Discord-Bot copied to clipboard

Slash.js

Open BigglesDevs opened this issue 1 year ago • 1 comments

Hello, this is strange to me so when i first clone the bot and use the slash it works perfectly fine but after a few time of it working it comes up with this and im not to sure why.

TypeError: Do not know how to serialize a BigInt
    at JSON.stringify (<anonymous>)
    at _REST.resolveRequest (D:\discord-Bots-WIP\Structure-Discord-Bot\node_modules\@discordjs\rest\dist\index.js:1393:26)
    at _REST.queueRequest (D:\discord-Bots-WIP\Structure-Discord-Bot\node_modules\@discordjs\rest\dist\index.js:1312:46)
    at _REST.request (D:\discord-Bots-WIP\Structure-Discord-Bot\node_modules\@discordjs\rest\dist\index.js:1278:33)
    at _REST.put (D:\discord-Bots-WIP\Structure-Discord-Bot\node_modules\@discordjs\rest\dist\index.js:1261:17)
    at D:\discord-Bots-WIP\Structure-Discord-Bot\slash.js:20:14
    at Object.<anonymous> (D:\discord-Bots-WIP\Structure-Discord-Bot\slash.js:32:3)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)```

BigglesDevs avatar May 21 '24 18:05 BigglesDevs

  1. Convert BigInt to String: Before sending data that might contain BigInt to JSON.stringify, convert the BigInt to a string. 2. Custom Replacer Function: Use a custom replacer function with JSON.stringify to handle BigInt values.

YockerFX avatar Jul 15 '24 21:07 YockerFX