Closed JuanJoZP closed 3 years ago
your get prefix function should be async https://github.com/OwenCalvin/discord.ts#dynamic-values
and follow this approach
thank you, I solved it making the function async and returning a promise that resolves a string
const getPrefix = (): Promise<string> => {
return new Promise((resolve, reject) => {
connection.query("SELECT prefix FROM config", (err, rows) => {
if (err) reject(err)
if (rows[0]?.prefix !== undefined) {
resolve(rows[0].prefix)
} else {
resolve("!")
}
})
})
}
@Discord(getPrefix, {
Hi. with mysql I have to return the results of a query througth a callback, but the Discord decorator doesn't accept that. I dont know how can i get the value that is passed to callback out of its scope in order to use it in the Discord decorator.