Skip to content

First skript-storage release!

Compare
Choose a tag to compare
@ItsTheSky ItsTheSky released this 13 Nov 13:07
· 8 commits to master since this release

skript-storage was made to handle file storing within three main ways:

  • YAML
  • JSON
  • TOML
    All of them have the same effects and expressions to edit, however have different advantages and disadvantages.

Check the official wiki here: https://skstorage.itsthesky.info/

Example code:

options:
	Name: Test

on load:
	create private shortcut for "plugins/{@Name}/config.yml" as "config"

	set default value "EnablePlugin" of "config" to true
	set comment of node "EnablePlugin" of "config" to " Either the Plugin is enabled or not."
	set default value "PluginPrefix" of "config" to "!"
	set comment of node "PluginPrefix" of "config" to " The prefix used in a lot of other features." and " Should be a one-char only!"
	
	# For example, bot configuration
	set default value "Token" of "config" to "YOUR TOKEN HERE"
	set comment of node "Token" of "config" to " The token of the bot." and " You can create one through Discord developer portal" and "THIS IS PRIVATE, send this token to nobody!"
	set default value "OwnerID" of "config" to 0
	set comment of node "OwnerID" of "config" to " The user ID of the bot owner." and " Allow multiple private permission commands."
	set default value "ModeratorsID" of "config" as list to 0 # Will force skript-storage to save it as a list
	set default values "RolesID" of "config" to 0, 1, 2 and 3

	# The header should always be changed after other edition.
	# (the custom comment parser could clear it sometimes)
	set framed header of "config" to "This is the main configuration file of {@Name}"

YAML result:

# +----------------------------------------------------+ #
# <    This is the main configuration file of Test     > #
# +----------------------------------------------------+ #
EnablePlugin: true
# The prefix used in a lot of other features.
# Should be a one-char only!
PluginPrefix: '!'
# The token of the bot.
# You can create one through Discord developer portal
# THIS IS PRIVATE, send this token to nobody!
Token: YOUR TOKEN HERE
# The user ID of the bot owner.
# Allow multiple private permission commands.
OwnerID: 0
ModeratorsID: 
- 0
RolesID: 
- 0
- 1
- 2
- 3

JSON Result:

{
   "RolesID": [
      0,
      1,
      2,
      3
   ],
   "OwnerID": 0,
   "ModeratorsID": [0],
   "Token": "YOUR TOKEN HERE",
   "EnablePlugin": true,
   "PluginPrefix": "!"
}

TOML Result:

OwnerID = 0
ModeratorsID = [0, ]
Token = "YOUR TOKEN HERE"
EnablePlugin = true
PluginPrefix = "!"
RolesID = [0, 1, 2, 3, ]