41 lines
709 B
Go
Raw Normal View History

2017-06-06 13:51:22 +00:00
package main
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
color.Yellow("Updating user references")
2017-11-01 19:11:05 +00:00
defer arn.Node.Close()
2017-06-06 13:51:22 +00:00
2017-11-01 19:11:05 +00:00
arn.DB.Clear("NickToUser")
arn.DB.Clear("EmailToUser")
arn.DB.Clear("GoogleToUser")
arn.DB.Clear("FacebookToUser")
2017-06-06 13:51:22 +00:00
// Iterate over the stream
count := 0
2017-11-01 19:11:05 +00:00
for user := range arn.StreamUsers() {
2017-06-06 13:51:22 +00:00
count++
println(count, user.Nick)
2017-06-24 00:10:04 +00:00
user.ForceSetNick(user.Nick)
2017-06-08 09:51:34 +00:00
if user.Email != "" {
user.SetEmail(user.Email)
}
2017-06-15 21:03:55 +00:00
if user.Accounts.Google.ID != "" {
2017-07-02 21:42:46 +00:00
user.ConnectGoogle(user.Accounts.Google.ID)
}
if user.Accounts.Facebook.ID != "" {
user.ConnectFacebook(user.Accounts.Facebook.ID)
2017-06-15 21:03:55 +00:00
}
2017-06-06 13:51:22 +00:00
}
color.Green("Finished.")
}