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