Basic /setup Saving into Database
This commit is contained in:
		
							parent
							
								
									6792a45e48
								
							
						
					
					
						commit
						bb4a1d5cf5
					
				|  | @ -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`); | ||||||
|  |             } | ||||||
|  |         }); | ||||||
| 	}, | 	}, | ||||||
| }; | }; | ||||||
		Loading…
	
		Reference in New Issue