I am trying to use a value (Discord User ID stored as a string) stored via quick.db in my code, but it returns me the error user_id: Value "[object Promise]" is not snowflake.
I've spent hours trying to figure it out but it just doesn't work. If I store the ID directly in the code it works just fine and I can fetch the user.
This is my "ready.js" file. The cron package lets me define at what time of the day that part of code is being executed. I don't think it's a part of the problem.
const Discord = require("discord.js")
const cron = require('cron');
const path = require('path');
const { QuickDB } = require("quick.db");
const db = new QuickDB()
module.exports = client => {
console.log(`${client.user.username} ist online`)
client.user.setActivity('Online!', { type: 'PLAYING' });
let userid1 = db.get("id1.string");
let scheduledMessage = new cron.CronJob('00 00 08 * * *', () => {
client.users.fetch(userid1).then(user => {
user.send('Test').catch(err => {
let channel = client.channels.cache.get('998568073034465341')
channel.send(`${user} blocked the bot`)
})
})
})
scheduledMessage.start()
}
This is where I want to utilize a User ID stored via quick.db in "id1.string"
client.users.fetch(userid1).then(user => {
-> This doesn't work
client.users.fetch(400120540989227010).then(user => {
-> This is working fine
I've already tried using
`${userid1}`
but this also doesn't work
I'd be so happy if someone could help me with that.