kanoxdb
v1.1.2
Published
easy database to use
Downloads
16
Readme
To install
npm i kanoxdb
create db
const db = require('kanoxdb)
client.on('message', async message => {
if(message.author.bot) return;
if(message.content.startsWith(prefix)) return;
if(message.content.startsWith(`-create`)){
db.create()//create the json file
db.add(`${message.author.id}`, 1)//add 1 coins to everyone that send a message, instead of the bot.
message.channel.send(`db is created !)//send success message
})
}
})
or
const db = require('kanoxdb)
db.create()
client.on('message', async message => {
if(message.author.bot) return;
if(message.content.startsWith(prefix)) return;
db.add(`${message.author.id}`, 1)//add 1 coins to everyone that send a message, instead of the bot.
})
set
client.on('message', async message => {
if(message.content.startsWith(`-set`)){
let channel = message.mentions.channels.first()
db.set(`welcomechannel`, channel.id)//set the name 'welcomechannel' with the value `${channel.id}`
message.channel.send(`${channel} has been seted to welcomechannel`)
}
})
get
client.on('message', async message => {
if(message.content.startsWith(`-get`)){
let welcomechannelID = db.get(`welcomechannel`)//get the channel id that we saved
let welcomechannel = client.channels.cache.get(welcomechannelID)//fetch the channel with id that we saved
message.channel.send(`welcome channel is ${welcomechannel}`)//send mention of welcome channel
}
})
add
client.on('message', async message => {
if(message.author.bot) return;
if(message.content.startsWith(prefix)) return;
if(message.content.startsWith(`-add`)){
db.add(`${message.author.id}`, 1)//add 1 coins to everyone that send a message, instead of the bot.
}
})
delete
client.on('message', async message => {
if(message.content.startsWith(`-delete`)){
db.delete(`welcomechannel`)//delete the welcomechannel key from the db
}
})
all
client.on('message', async message => {
if(message.content.startsWith(`-all`)){
db.all().join("\n")//show you all the keys that you saved (like `welcomechannel` etc.)
}
})