antoinemcx / Structure-Discord-Bot

🚀 Command, slash command & event handler - Discord Bot Template (v14)
https://discord.gg/G6WQsMQShZ
MIT License
85 stars 10 forks source link

Slash.js #7

Open BigglesDevs opened 3 months ago

BigglesDevs commented 3 months ago

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)```
YockerFX commented 1 month ago
  1. Convert BigInt to String: Before sending data that might contain BigInt to JSON.stringify, convert the BigInt to a string.
    1. Custom Replacer Function: Use a custom replacer function with JSON.stringify to handle BigInt values.