Json Data Storage In Guilds
I've gotten decently into making bots for discord, and have really been enjoying messing around with it! But a difficult part is always getting to the point where you have to add a database to the bot, it's a pain, especially if you only want simple on and off features. It got me thinking about a feature that could be added. A special place for a bot to submit and pull it's own data from the server, a blank JSON object assigned to a bot on join.
This would make toggles far easier, when the bot joins, the guild automatically creates that bots private JSON object, so the owner could modify that bots options, and instead of logging all the changes and toggles to a database, it would just change it in the JSON object the guild provides to the bot.
This would allow for easier statistics tracking, IE counting the amount of messages in a server, joins, leaves, and general frequent events, letting you just push it to a simple JSON object for that guild, rather then storing it on the hosting machine's database. No need for structuring.
Example:
``msg.guild.((json.msgcount)) = msg.guild.json.msgcount + 1`` - Would add one counter to the guild's json object to track messages,
``if (command === 'true') {
msg.guild.json.toggle = true
}`` - Would set a toggle feature to on.
I'm still new to all of this, so there may be complications, or alternatives that are just as easy, if so, feel free to let me know! It's just an idea I had <3
-Aurora
-
I think it should store raw text, and the bot developer can use whatever format they seem fit.
1
Please sign in to leave a comment.
Comments
1 comment