Mikey
Mikey
DIAdiscord.js - Imagine an app
Created by Mikey on 7/6/2024 in #djs-questions
channels.create().then() runs before the result is acquired
Trying to figure out why my query is getting ran before the result is acquired here:
const guildCategory = interaction.guild.channels.create({name: "Guilds", type: ChannelType.GuildCategory}).then((result)=>{
//Runs before it should VVV
connection.query(`INSERT INTO \`ServerSettings\` (\`serverID\`, \`guildsCategory\`) VALUES (${interaction.guild.id},${result.id})`,
function(err,result,fields){
if(err) {
interaction.reply('An Error Occurred: While trying to add the channels to the database.')
console.error(err)
}
else interaction.reply('Setup Completed');
});
});
const guildCategory = interaction.guild.channels.create({name: "Guilds", type: ChannelType.GuildCategory}).then((result)=>{
//Runs before it should VVV
connection.query(`INSERT INTO \`ServerSettings\` (\`serverID\`, \`guildsCategory\`) VALUES (${interaction.guild.id},${result.id})`,
function(err,result,fields){
if(err) {
interaction.reply('An Error Occurred: While trying to add the channels to the database.')
console.error(err)
}
else interaction.reply('Setup Completed');
});
});
appreciate any help
10 replies
DIAdiscord.js - Imagine an app
Created by Mikey on 1/4/2024 in #djs-questions
Default commands get added for no reason?
No description
10 replies