mirror of
https://github.com/Fluffy-Bean/Lynxie.git
synced 2025-05-28 22:33:14 +00:00
Set build hash and pipeline link through LDFlags
Add custom command values to config
This commit is contained in:
parent
eb50802d1e
commit
a0bb37fc06
5 changed files with 36 additions and 21 deletions
|
@ -6,7 +6,6 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
@ -18,8 +17,6 @@ import (
|
|||
var client = http.Client{
|
||||
Timeout: 10 * time.Second,
|
||||
}
|
||||
var username = os.Getenv("E621_USERNAME")
|
||||
var password = os.Getenv("E621_PASSWORD")
|
||||
|
||||
type post struct {
|
||||
Id int `json:"id"`
|
||||
|
@ -57,13 +54,18 @@ type post struct {
|
|||
}
|
||||
|
||||
func RegisterPorbCommands(a *app.App) {
|
||||
if username != "" && password != "" {
|
||||
a.RegisterCommand("e621", registerE621(a))
|
||||
username, _ := a.Config.CommandExtras["e621_username"]
|
||||
password, _ := a.Config.CommandExtras["e621_password"]
|
||||
|
||||
a.RegisterCommandAlias("porb", "e621")
|
||||
} else {
|
||||
if username == "" || password == "" {
|
||||
log.Println("Not registering e621 command...")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
a.RegisterCommand("e621", registerE621(a))
|
||||
|
||||
a.RegisterCommandAlias("porb", "e621")
|
||||
}
|
||||
|
||||
func registerE621(a *app.App) app.Callback {
|
||||
|
@ -99,6 +101,9 @@ func registerE621(a *app.App) app.Callback {
|
|||
}
|
||||
}
|
||||
|
||||
username, _ := a.Config.CommandExtras["e621_username"]
|
||||
password, _ := a.Config.CommandExtras["e621_password"]
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
req.Header.Add("User-Agent", fmt.Sprintf("Lynxie/2.0 (by %s on e621)", username))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue