• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.
Resource icon

SConomy NG Database Plugin 1.1.2

No permission to download

Mmoi

Active Member
Contributor
Mmoi submitted a new resource:

SConomy NG Database Plugin - A plugin that manages SConomy NG database storage

SConomy NG Database Plugin adds the database storage to SConomy NG.

Setup:
In the config.ini files (next to the script folder), add the 2 following lines (allow the database connection):
[Scripts.Privileges]
sconomy-ng-db = ["db"]

Database credentials / info:
Go to the sconomy-ng-db.js file (line 44) and modify the "var database = {...}" with your info.
Once the info are there, place the script into the script folder...

Read more about this resource...
 
So if I use this plugin, it will save the data in a database. so I could theoretically check someones probucks through a webpage with database connection, is that right?
 

Mmoi

Active Member
Contributor
So if I use this plugin, it will save the data in a database. so I could theoretically check someones probucks through a webpage with database connection, is that right?
Yes, you can do whatever you want with the database. Check it, add money, remove some or even add some item to the store when they are sold out.
The disavantage of this is that some scripts don't have the support for the database yet (fortune, for example)...
 
Ah okay, can I just implement the script and will it keep all the points of every user? Or will the switch to database reset every data to 0? And is there a way to back up the data before switching to database?
 

Mmoi

Active Member
Contributor
Ah okay, can I just implement the script and will it keep all the points of every user? Or will the switch to database reset every data to 0? And is there a way to back up the data before switching to database?
For the general purpose, you can backup the files that contains the data (sinusbot/data/db/*).
Otherwise, I explained how to migrate the data from a provider to another here. Note that the database plugin adds some optons to the migration tool (see here).

Feel free to ask me if you have any issue.
 
For the general purpose, you can backup the files that contains the data (sinusbot/data/db/*).
Otherwise, I explained how to migrate the data from a provider to another here. Note that the database plugin adds some optons to the migration tool (see here).

Feel free to ask me if you have any issue.

Ah okay, well I added

[Scripts.Privileges]
sconomy-ng-db = ["db"]

to the config.ini next to the scripts folder.

Added the sconomy-ng-db.js into the script folder and filled out the database info in the sinusbot web interface.

Now I was trying to use this command

!sconomy-data-migration-tool public_db

to copy the public information to the database, but it says "Unknown argument". Any idea?
 

Mmoi

Active Member
Contributor
Added the sconomy-ng-db.js into the script folder and filled out the database info in the sinusbot web interface.
Now I was trying to use this command to copy the public information to the database, but it says "Unknown argument". Any idea?
Did you enable the provider override? It's (one of) the first checkbox in the Database Plugin config.

If so, check your logs to see if the database plugin has been loaded.
 
Ah yeah, my fault, when the override is checked, the command works. However, somehow after typing in the command and confirming it, the database does some changes, but most of my users have 0 points again, like when its resetted. Hm..

Edit:

Log says after 5 seconds of the command: 2019-01-07T22:17:20+01:00 Error in script (event chat): timeout
 

Mmoi

Active Member
Contributor
Ah yeah, my fault, when the override is checked, the command works. However, somehow after typing in the command and confirming it, the database does some changes, but most of my users have 0 points again, like when its resetted. Hm..

Edit:

Log says after 5 seconds of the command: 2019-01-07T22:17:20+01:00 Error in script (event chat): timeout
Oh, damn, I know. The same problem as in Sconomy NG some time ago... The migration didn't finished because the function timeout is set to 5s by default.

So, I'll update the script soon, but for now you can make it via the following workaround:
Edit config.ini
In the [Scripts] section, modify ScriptTimeout = 5 by ScriptTimeout = 600.
Run the migration command.
Check the logs to see if everything is OK.
Modify the config.ini to make it back to 5.
 
Oh, damn, I know. The same problem as in Sconomy NG some time ago... The migration didn't finished because the function timeout is set to 5s by default.

So, I'll update the script soon, but for now you can make it via the following workaround:
Edit config.ini
In the [Scripts] section, modify ScriptTimeout = 5 by ScriptTimeout = 600.
Run the migration command.
Check the logs to see if everything is OK.
Modify the config.ini to make it back to 5.

Thanks! That worked. :D
 
Oh, damn, I know. The same problem as in Sconomy NG some time ago... The migration didn't finished because the function timeout is set to 5s by default.

So, I'll update the script soon, but for now you can make it via the following workaround:
Edit config.ini
In the [Scripts] section, modify ScriptTimeout = 5 by ScriptTimeout = 600.
Run the migration command.
Check the logs to see if everything is OK.
Modify the config.ini to make it back to 5.

There is another problem I can't figur out. So, my database has the information I exported. The sconomy-ng-db script has "Override SConomy NG default storage with an external one" checked, and Override generation interval set to 10 for example.

But the users coins ARE NOT updating any more since I exported the data to the database and installed the database plugin. So everytime they ask the bot how much coins they have, they have the same amount as before the database plugin implementation.

the normal sconomy-ng script is still set to public (as i can only choose between public and private)

Is there anything I may have forgotten? :/
 

Mmoi

Active Member
Contributor
The sconomy-ng-db script has "Override SConomy NG default storage with an external one" checked, and Override generation interval set to 10 for example.

Is there anything I may have forgotten? :/
Example: you have sconomy ng set to generate 5 every 60 seconds, the script will update the user progress every second to get to 60/60 and then give them 5 coins.
When you say 10 to the DB plugin, this means that the script will update the user progress every 10 second, therefore, the users will now need 10*60 seconds to get the 5 coins.

Hope I was clear enough :)
 

MrAlex

Active Member
I have a problem, if i turn on database plugin, the script not count the coins. Every user has 0 coins. Can you help me?
 

MrAlex

Active Member
Yes, the database is set up well. I can give money with a command and it can be seen in the database, but if I get a command with how much money I have, it says 0.

The log say:

2020-02-15T14:07:16+01:00 unloaded instance
2020-02-15T14:07:16+01:00 > flush done
2020-02-15T14:07:11+01:00 [ sconomy-ng-db:115:20] SConomy NG DB: Main table exists or created
2020-02-15T14:07:11+01:00 queued serialized callback
2020-02-15T14:07:11+01:00 [ sconomy-ng-db:115:20] SConomy NG DB: Integer table exists or created
2020-02-15T14:07:11+01:00 queued serialized callback
2020-02-15T14:07:11+01:00 [ sconomy-ng-db:115:20] SConomy NG DB: Connected
 

Mmoi

Active Member
Contributor
Yes, the database is set up well. I can give money with a command and it can be seen in the database, but if I get a command with how much money I have, it says 0.

The log say:

2020-02-15T14:07:16+01:00 unloaded instance
2020-02-15T14:07:16+01:00 > flush done
2020-02-15T14:07:11+01:00 [ sconomy-ng-db:115:20] SConomy NG DB: Main table exists or created
2020-02-15T14:07:11+01:00 queued serialized callback
2020-02-15T14:07:11+01:00 [ sconomy-ng-db:115:20] SConomy NG DB: Integer table exists or created
2020-02-15T14:07:11+01:00 queued serialized callback
2020-02-15T14:07:11+01:00 [ sconomy-ng-db:115:20] SConomy NG DB: Connected
Which version of the bot are you using?
Does the bot sets the right amount in the DB when time passes?
 
Top