简体   繁体   English

关于 Quick.db 模块:

[英]About the Quick.db module:

db module is possible to add writings. db 模块可以添加文字。 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])) 

尝试这个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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