Improved shop

This commit is contained in:
2017-10-06 12:44:55 +02:00
parent 7e5acf5a97
commit bb39234f2d
14 changed files with 253 additions and 77 deletions

View File

@ -85,7 +85,9 @@ Includes:
Price: 100,
Description: `Support the makers of your favourite anime by using an anime support ticket.
Anime Notifier uses 10% of the money to handle the transaction fees while the remaining 90% go directly
to the studios involved in the creation of your favourite anime.`,
to the studios involved in the creation of your favourite anime.
*This feature is work in progress.*`,
Icon: "ticket",
Rarity: arn.ItemRarityRare,
Order: 5,

View File

@ -0,0 +1,38 @@
package main
import (
"flag"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
// Shell parameters
var confirmed bool
// Shell flags
func init() {
flag.BoolVar(&confirmed, "confirm", false, "Confirm that you really want to execute this.")
flag.Parse()
}
func main() {
if !confirmed {
color.Green("Please run this command with -confirm option if you really want to delete all pro subscriptions.")
return
}
color.Yellow("Deleting all pro subscriptions")
// Get a stream of all users
allUsers, err := arn.StreamUsers()
arn.PanicOnError(err)
// Iterate over the stream
for user := range allUsers {
user.Balance = 0
arn.PanicOnError(user.Save())
}
color.Green("Finished.")
}

View File

@ -1,14 +1,29 @@
package main
import (
"flag"
"fmt"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
// Shell parameters
var confirmed bool
// Shell flags
func init() {
flag.BoolVar(&confirmed, "confirm", false, "Confirm that you really want to execute this.")
flag.Parse()
}
func main() {
color.Yellow("Adding inventories to users who don't have one")
if !confirmed {
color.Green("Please run this command with -confirm option.")
return
}
color.Yellow("Resetting all inventories")
// Get a stream of all users
allUsers, err := arn.StreamUsers()
@ -16,20 +31,9 @@ func main() {
// 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)
// // TEST
// inventory.AddItem("anime-support-ticket", 50)
// inventory.AddItem("pro-account-24", 30)
err = arn.DB.Set("Inventory", inventory.UserID, inventory)
if err != nil {