discord-temp-channels
discord-temp-channels copied to clipboard
Error after restarting bot with quick.db
"stack": "TypeError: parentChannel.options.childFormat is not a function Thats the error when i set the voicechannel with quick,db and restart my bot. When i then join the voicechannel the error pops up and doesnt create a new voice channel. When i run the set command, the channel is already set and recognized tho, so i dont think it deletes the channel. Idk what to do, because i also tried it with mongoDB and didnt got it working. Can u help me there ? The code snippet from u: Here + the full error Here . Thanks!
Hello @UnDeadLolomat :D
Would it be possible to tell us what happens when you save the options to the database? It seems that options.childFormat is not a function once you set it with db.push.
The problem is probably located in two places here:
- first place is when you save the data in quick.db:
db.push("temp-channels", {
channelID: message.member.voice.channel.id,
options: options
});
- second is when you get that data back from quick.db and use it directly:
db.get("temp-channels").forEach((channelData) => {
tempChannels.registerChannel(channelData.channelID, channelData.options);
});
The best way to troubleshoot this would be to check the typeof the options property of channelData in your forEach loop.
i have this error too but i have no clue on how to fix
@HunteRoi
Hello there @NotMinhDucGamingTV & @UnDeadLolomat !
The issue is due to your options#childFormat not being inserted in the quick.db. As you may know, once an object is translated into JSON, it only keeps its attributes, not its methods. Which mean that:
{
childAutoDeleteIfEmpty: true,
childAutoDeleteIfOwnerLeaves: true,
childMaxUsers: 3,
childBitrate: 64000,
childFormat: (member, count) => `#${count} | ${member.user.username}'s lounge`
}
will effectively become the following once saved in the database:
{
"childAutoDeleteIfEmpty": true,
"childAutoDeleteIfOwnerLeaves": true,
"childMaxUsers": 3,
"childBitrate": 64000
}