Added ability to refresh specific avatars on jobs/avatars
This commit is contained in:
parent
37114a80d9
commit
360190586f
@ -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
45
jobs/avatars/shell.go
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user