要使用的 Discord.js 数据库 [英] Discord.js databases to use

查看:16
本文介绍了要使用的 Discord.js 数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写我的第一个 discord 机器人,我需要一些帮助来了解哪个数据库适合这项工作到目前为止,我已经尝试将所需的数据保存在 json 文件中,但遇到了一些问题,并听到有人说这很糟糕练习我的机器人是一个虚拟的送餐机器人,我曾经将这样的数据存储在 json 文件中

I'm coding my first discord bot and I need some help in knowing which database would fit for this job so far I have tried saving my needed data in a json file but encountered some issues and heard some say that it's a bad practice my bot is a virtual food delivery bot which I used to store data like this in the json file


{
    "001": {
        "guildID": "some data here",
        "customer": "some data here",
        "order details": "some data here"
    }
}

通常这些数据会在订单"之后被删除.已交付,所以我认为我不需要大数据库?对存储这些数据的更好方法有什么建议吗?

usually these data get deleted after an "order" is delivered so I don't think I would need a big database? any suggestions for better ways to store these data?

推荐答案

是的,JSON 对于数据库来说是个糟糕的选择.根据 Discord.JS 维护者的说法:

Yes, JSON is a poor choice for a database. According to the Discord.JS maintainers:

JSON 文件在大量写入和读取时容易损坏,这就是为什么不应将它们用作数据库的一种形式"

"JSON files are prone to corruption when written to and read from a lot, which is why they should not be used as a form of database"

Discord.JS 指南包括 2 个关于使用 KeyvSequelize.

The Discord.JS guide includes 2 tutorials on setting up databases using Keyv or Sequalize.

这篇关于要使用的 Discord.js 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆