Shop improvements
This commit is contained in:
@ -12,18 +12,15 @@ func main() {
|
||||
|
||||
// Get a stream of all users
|
||||
allUsers, err := arn.StreamUsers()
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
arn.PanicOnError(err)
|
||||
|
||||
// Iterate over the stream
|
||||
for user := range allUsers {
|
||||
// exists, err := arn.DB.Exists("UserFollows", user.ID)
|
||||
exists, err := arn.DB.Exists("UserFollows", user.ID)
|
||||
|
||||
// if err != nil || exists {
|
||||
// continue
|
||||
// }
|
||||
if err != nil || exists {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Println(user.Nick)
|
||||
|
||||
|
36
patches/add-inventories/add-inventories.go
Normal file
36
patches/add-inventories/add-inventories.go
Normal file
@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Adding inventories to users who don't have one")
|
||||
|
||||
// Get a stream of all users
|
||||
allUsers, err := arn.StreamUsers()
|
||||
arn.PanicOnError(err)
|
||||
|
||||
// Iterate over the stream
|
||||
for user := range allUsers {
|
||||
exists, err := arn.DB.Exists("Inventory", user.ID)
|
||||
|
||||
if err != nil || exists {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Println(user.Nick)
|
||||
|
||||
inventory := arn.NewInventory(user.ID)
|
||||
err = arn.DB.Set("Inventory", inventory.UserID, inventory)
|
||||
|
||||
if err != nil {
|
||||
color.Red(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
color.Green("Finished.")
|
||||
}
|
Reference in New Issue
Block a user