It's my first time working with a database and I ran into a problem. I want to make an embed with information from a database. The Bot can only read those informations and not change anything. I set up the Bot with the Database using npm mysql. Now I got my Database connection ready and the embed ready but I don't really know how to combine those two things. In the Value fields from the embed should the information from the database go. For example, in the database there's a column with male players, and because they change throughout the day I want to make an embed that shows exactly how many male players there are when somebody types in the command info.
Database Connection Code (everything is private for a reason):
const connection = mysql.createConnection({
host : 'private',
port : 'private',
user : 'private',
password : 'private',
database : 'private',
charset : 'private'
});
connection.connect()
My Code for the embed (in the value fields should the information from the database go):
if(message.content.startsWith(prefix + 'info')) {
const sembed = new Discord.MessageEmbed()
.setTitle('Info:')
.setThumbnail('png')
.setColor('GOLD')
.addFields(
{name: 'Players:', value: ''},
{name: '👨🏻', value: '', inline: true},
{name: '👩🏻', inline: true},
{name: '👧🏻', value: '', inline: true},
)
.setTimestamp()
message.channel.send({embeds: [sembed]})
}
')? You can see where with syntax highlighting