Finished shop system

This commit is contained in:
2017-10-05 13:48:16 +02:00
parent 71303ef351
commit a52668ada5
9 changed files with 127 additions and 11 deletions

View File

@ -0,0 +1,22 @@
package main
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
color.Yellow("Adding balance to all users")
// Get a stream of all users
allUsers, err := arn.StreamUsers()
arn.PanicOnError(err)
// Iterate over the stream
for user := range allUsers {
user.Balance += 100000
arn.PanicOnError(user.Save())
}
color.Green("Finished.")
}

View File

@ -16,19 +16,19 @@ func main() {
// Iterate over the stream
for user := range allUsers {
// exists, err := arn.DB.Exists("Inventory", user.ID)
exists, err := arn.DB.Exists("Inventory", user.ID)
// if err != nil || exists {
// continue
// }
if err != nil || exists {
continue
}
fmt.Println(user.Nick)
inventory := arn.NewInventory(user.ID)
// TEST
inventory.AddItem("anime-support-ticket", 50)
inventory.AddItem("pro-account-24", 30)
// // TEST
// inventory.AddItem("anime-support-ticket", 50)
// inventory.AddItem("pro-account-24", 30)
err = arn.DB.Set("Inventory", inventory.UserID, inventory)