Finished shop system
This commit is contained in:
22
patches/add-balance/add-balance.go
Normal file
22
patches/add-balance/add-balance.go
Normal 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.")
|
||||
}
|
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user