I have a function that returns the guilds prefix in Discord.JS:
getprefix.js:
const GuildSchema = require("../Database/Models/GuildConfigs");
const { DEFAULT } = require("./config");
const getprefix = async (id) => {
const guildConfigs = await GuildSchema.findOne({
GuildID: id,
});
let PREFIX = DEFAULT;
if (guildConfigs && guildConfigs?.Prefix) {
PREFIX = guildConfigs?.Prefix;
}
};
module.exports = { getprefix };
I call the function in another file using this:
let prefix = getprefix(message.guild.id);
prefix.then(() => {
console.log(prefix);
});
The problem is it returns this in the console:
Promise { '!' }
Is it possible to just return the actual prefix that is inside the quotes with out the Promise?