Added ability to refresh specific avatars on jobs/avatars

This commit is contained in:
Eduard Urbach 2017-06-22 09:29:31 +02:00
parent 37114a80d9
commit 360190586f
2 changed files with 49 additions and 0 deletions

View File

@ -75,6 +75,10 @@ func main() {
},
}
if InvokeShellArgs() {
return
}
// Stream of all users
users, _ := arn.FilterUsers(func(user *arn.User) bool {
return true

45
jobs/avatars/shell.go Normal file
View File

@ -0,0 +1,45 @@
package main
import (
"flag"
"github.com/animenotifier/arn"
)
// Shell parameters
var userID string
var userNick string
// Shell flags
func init() {
flag.StringVar(&userID, "id", "", "ID of the user whose avatar you want to refresh")
flag.StringVar(&userNick, "nick", "", "Nickname of the user whose avatar you want to refresh")
flag.Parse()
}
// InvokeShellArgs ...
func InvokeShellArgs() bool {
if userID != "" {
user, err := arn.GetUser(userID)
if err != nil {
panic(err)
}
Work(user)
return true
}
if userNick != "" {
user, err := arn.GetUserByNick(userNick)
if err != nil {
panic(err)
}
Work(user)
return true
}
return false
}