t
This commit is contained in:
@@ -92,7 +92,6 @@ func formatMessageContent(m tempest.Message) string {
|
|||||||
">>> **PIN DU JOUR**",
|
">>> **PIN DU JOUR**",
|
||||||
fmt.Sprintf("par **%s** le %s", m.Author.Username, m.Timestamp.Format("02/01/2006 15:04")),
|
fmt.Sprintf("par **%s** le %s", m.Author.Username, m.Timestamp.Format("02/01/2006 15:04")),
|
||||||
m.Content,
|
m.Content,
|
||||||
m.Author.AvatarHash,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return strings.Join(lines, "\n")
|
return strings.Join(lines, "\n")
|
||||||
|
|||||||
@@ -5,15 +5,12 @@ import (
|
|||||||
"hal/commands"
|
"hal/commands"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
tempest "github.com/Amatsagu/Tempest"
|
tempest "github.com/Amatsagu/Tempest"
|
||||||
)
|
)
|
||||||
|
|
||||||
var serverIDs []tempest.Snowflake = []tempest.Snowflake{
|
|
||||||
992760761812258868, // test server
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
env := getEnvVariables()
|
env := getEnvVariables()
|
||||||
|
|
||||||
@@ -36,7 +33,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if err := initialize(client); err != nil {
|
if err := initialize(client, env.ServerIDs); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +51,7 @@ func main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func initialize(c tempest.Client) error {
|
func initialize(c tempest.Client, serverIDs []tempest.Snowflake) error {
|
||||||
if err := commands.InitPinned(c, serverIDs); err != nil {
|
if err := commands.InitPinned(c, serverIDs); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -64,12 +61,20 @@ func initialize(c tempest.Client) error {
|
|||||||
|
|
||||||
func getEnvVariables() Env {
|
func getEnvVariables() Env {
|
||||||
if os.Getenv("RAILWAY_ENVIRONMENT") == "production" {
|
if os.Getenv("RAILWAY_ENVIRONMENT") == "production" {
|
||||||
|
ids := strings.Split(os.Getenv("SERVER_IDS"), ",")
|
||||||
|
|
||||||
|
serverIDs := []tempest.Snowflake{}
|
||||||
|
for _, id := range ids {
|
||||||
|
serverIDs = append(serverIDs, tempest.StringToSnowflake(id))
|
||||||
|
}
|
||||||
|
|
||||||
return Env{
|
return Env{
|
||||||
AppID: tempest.StringToSnowflake(os.Getenv("APP_ID")),
|
AppID: tempest.StringToSnowflake(os.Getenv("APP_ID")),
|
||||||
PublicKey: os.Getenv("PUBLIC_KEY"),
|
PublicKey: os.Getenv("PUBLIC_KEY"),
|
||||||
Token: os.Getenv("TOKEN"),
|
Token: os.Getenv("TOKEN"),
|
||||||
Port: "8080",
|
Port: "8080",
|
||||||
Addr: os.Getenv("ADDR"),
|
Addr: os.Getenv("ADDR"),
|
||||||
|
ServerIDs: serverIDs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,4 +88,5 @@ type Env struct {
|
|||||||
Token string
|
Token string
|
||||||
Port string
|
Port string
|
||||||
Addr string
|
Addr string
|
||||||
|
ServerIDs []tempest.Snowflake
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user