简体   繁体   中英

About the Quick.db module:

db module is possible to add writings. But is it possible to subtract the writings? It may also be caused by my incompetence this is my code:

const db = require('quick.db')
const Discord = require('discord.js')


exports.run = async (client, message, args, config) => {

    if(message.author.id === 'My ID'){ 


    let user = message.mentions.members.first() || message.author

    if (args[0]) return message.channel.send(`${message.author}, bir eşya ismi girmen gerek!`)
    db.subtract(`${user.id}.envan`, args[0]) 
    let bal = await db.fetch(`${user.id}.envan`)

    let embed = new Discord.RichEmbed()
    .setAuthor(`Your item is received!`, message.author.displayAvatarURL)
    .addField(`Received Item:`, `${args[0]}`)
    .setColor("RED")
    .setTimestamp()
    message.channel.send(embed)
    }else{
return message.channels.send('Yetkin yok knk').then(msg => {
            setTimeout(() => {
                msg.delete()
            }, 2500);
        })
    }
}

如果您想删除引用而不是“减去”,您可以使用db.delete (因为这似乎是您问题中的目标)

db.subtract(`${user.id}.envan`, Math.floor(args[0])) 

尝试这个。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM