2017-06-22 07:29:31 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
|
|
|
|
"github.com/animenotifier/arn"
|
2017-07-18 05:23:48 +00:00
|
|
|
"github.com/animenotifier/avatar/lib"
|
2017-06-22 07:29:31 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
}
|
|
|
|
|
2017-07-18 05:23:48 +00:00
|
|
|
lib.RefreshAvatar(user)
|
2017-06-22 07:29:31 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
if userNick != "" {
|
|
|
|
user, err := arn.GetUserByNick(userNick)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2017-07-18 05:23:48 +00:00
|
|
|
lib.RefreshAvatar(user)
|
2017-06-22 07:29:31 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|