1.1.2 • Published 3 years ago

kanoxdb v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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.)
    }
})
1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago