Basic /setup Saving into Database

This commit is contained in:
ui_creeperlv 2024-03-06 14:00:53 +05:30
parent 6792a45e48
commit bb4a1d5cf5
1 changed files with 14 additions and 3 deletions

View File

@ -15,8 +15,19 @@ module.exports = {
async execute(interaction) { async execute(interaction) {
var channel = interaction.options.getChannel("channel"); var channel = interaction.options.getChannel("channel");
console.log(channel); interaction.client.database.search("xan.guilds" , {
serverId : interaction.guild.id
await interaction.reply('Pong!'); } , async (data) => {
if(data == null){
interaction.client.database.insert("xan.guilds" , {
serverId : interaction.guild.id,
channelId : channel.id
}, async (c) => {
await interaction.reply(`Saved Channel as #${channel.name} in Database`);
})
}else{
await interaction.reply(`Guild is already saved into Database`);
}
});
}, },
}; };