mirror of
https://github.com/Fluffy-Bean/Lynxie.git
synced 2025-05-14 08:02:17 +00:00
Update pipeline
And commit half-baked code restructure
This commit is contained in:
parent
5d67b2e2b0
commit
2e5f4bce11
11 changed files with 32 additions and 59 deletions
|
@ -15,9 +15,9 @@ steps:
|
|||
- mkdir -p ~/.ssh
|
||||
- echo "$SSH_KEY" > ~/.ssh/id_rsa
|
||||
- chmod 600 ~/.ssh/id_rsa
|
||||
- ssh -o StrictHostKeyChecking=no uncertainty@192.168.0.44 "rm $COPY_TO || true"
|
||||
- scp -o StrictHostKeyChecking=no $COPY_FROM uncertainty@192.168.0.44:$COPY_TO
|
||||
- ssh -o StrictHostKeyChecking=no uncertainty@192.168.0.44 "doas service lynxie restart"
|
||||
- ssh -o StrictHostKeyChecking=no uncertainty@192.168.178.31 "rm $COPY_TO || true"
|
||||
- scp -o StrictHostKeyChecking=no $COPY_FROM uncertainty@192.168.178.31:$COPY_TO
|
||||
- ssh -o StrictHostKeyChecking=no uncertainty@192.168.178.31 "doas service lynxie restart"
|
||||
environment:
|
||||
COPY_FROM: lynxie
|
||||
COPY_TO: /home/uncertainty/lynxie
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/Fluffy-Bean/lynxie/utils"
|
||||
"github.com/Fluffy-Bean/lynxie/internal/color"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
|
@ -132,7 +132,7 @@ func printHelp(a *App, h *Handler) {
|
|||
Embed: &discordgo.MessageEmbed{
|
||||
Title: "Help",
|
||||
Description: strings.Join(commands, "\n"),
|
||||
Color: utils.ColorFromRGB(255, 255, 255),
|
||||
Color: color.RGBToDiscord(255, 255, 255),
|
||||
},
|
||||
Reference: h.Reference,
|
||||
})
|
||||
|
@ -145,7 +145,7 @@ func printError(a *App, h *Handler, e Error) {
|
|||
Embed: &discordgo.MessageEmbed{
|
||||
Title: "Error",
|
||||
Description: e.Msg,
|
||||
Color: utils.ColorFromRGB(255, 0, 0),
|
||||
Color: color.RGBToDiscord(255, 0, 0),
|
||||
},
|
||||
Reference: h.Reference,
|
||||
})
|
||||
|
|
5
internal/color/color.go
Normal file
5
internal/color/color.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package color
|
||||
|
||||
func RGBToDiscord(r, g, b int) int {
|
||||
return (r << 16) + (g << 8) + b
|
||||
}
|
10
internal/err/err.go
Normal file
10
internal/err/err.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package err
|
||||
|
||||
type Error struct {
|
||||
Msg string
|
||||
Err error
|
||||
}
|
||||
|
||||
func (e *Error) Ok() bool {
|
||||
return e.Err == nil
|
||||
}
|
36
main.go
36
main.go
|
@ -1,36 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/Fluffy-Bean/lynxie/app"
|
||||
"github.com/Fluffy-Bean/lynxie/commands/debug"
|
||||
"github.com/Fluffy-Bean/lynxie/commands/img"
|
||||
"github.com/Fluffy-Bean/lynxie/commands/porb"
|
||||
"github.com/Fluffy-Bean/lynxie/commands/tinyfox"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
var ConfigBuildHash string
|
||||
var ConfigBuildPipeline string
|
||||
|
||||
func main() {
|
||||
a := app.NewApp(app.Config{
|
||||
BotPrefix: ">",
|
||||
BotToken: os.Getenv("TOKEN"),
|
||||
BotIntents: discordgo.IntentsGuildMessages,
|
||||
CommandExtras: map[string]string{
|
||||
"debug_build-hash": ConfigBuildHash,
|
||||
"debug_build-pipeline": ConfigBuildPipeline,
|
||||
"e621_username": os.Getenv("E621_USERNAME"),
|
||||
"e621_password": os.Getenv("E621_PASSWORD"),
|
||||
},
|
||||
})
|
||||
|
||||
debug.RegisterDebugCommands(a)
|
||||
img.RegisterImgCommands(a)
|
||||
tinyfox.RegisterTinyfoxCommands(a)
|
||||
porb.RegisterPorbCommands(a)
|
||||
|
||||
a.Run()
|
||||
}
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/Fluffy-Bean/lynxie/app"
|
||||
"github.com/Fluffy-Bean/lynxie/utils"
|
||||
"github.com/Fluffy-Bean/lynxie/internal/color"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
|
@ -67,7 +67,7 @@ func registerDebug(a *app.App) app.Callback {
|
|||
Inline: false,
|
||||
},
|
||||
},
|
||||
Color: utils.ColorFromRGB(255, 255, 255),
|
||||
Color: color.RGBToDiscord(255, 255, 255),
|
||||
},
|
||||
Reference: h.Reference,
|
||||
})
|
|
@ -6,7 +6,6 @@ import (
|
|||
_ "embed"
|
||||
"errors"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/jpeg"
|
||||
"image/png"
|
||||
"io"
|
||||
|
@ -16,7 +15,7 @@ import (
|
|||
|
||||
"git.sr.ht/~sbinet/gg"
|
||||
"github.com/Fluffy-Bean/lynxie/app"
|
||||
"github.com/Fluffy-Bean/lynxie/utils"
|
||||
"github.com/Fluffy-Bean/lynxie/internal/color"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
|
@ -78,7 +77,7 @@ func registerSaveable(a *app.App) app.Callback {
|
|||
Image: &discordgo.MessageEmbedImage{
|
||||
URL: "attachment://saveable.gif",
|
||||
},
|
||||
Color: utils.ColorFromRGB(255, 255, 255),
|
||||
Color: color.RGBToDiscord(255, 255, 255),
|
||||
},
|
||||
Files: []*discordgo.File{
|
||||
{
|
||||
|
@ -179,10 +178,10 @@ func registerCaption(a *app.App) app.Callback {
|
|||
}
|
||||
}
|
||||
|
||||
canvas.SetColor(color.RGBA{R: 255, G: 255, B: 255, A: 255})
|
||||
canvas.SetRGBA(255, 255, 255, 255)
|
||||
canvas.Clear()
|
||||
|
||||
canvas.SetColor(color.RGBA{R: 0, G: 0, B: 0, A: 255})
|
||||
canvas.SetRGBA(0, 0, 0, 255)
|
||||
canvas.DrawStringWrapped(
|
||||
strings.Join(args, " "),
|
||||
float64(img.Bounds().Dx()/2),
|
||||
|
@ -213,7 +212,7 @@ func registerCaption(a *app.App) app.Callback {
|
|||
Image: &discordgo.MessageEmbedImage{
|
||||
URL: "attachment://caption.jpeg",
|
||||
},
|
||||
Color: utils.ColorFromRGB(255, 255, 255),
|
||||
Color: color.RGBToDiscord(255, 255, 255),
|
||||
},
|
||||
Files: []*discordgo.File{
|
||||
{
|
|
@ -10,7 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Fluffy-Bean/lynxie/app"
|
||||
"github.com/Fluffy-Bean/lynxie/utils"
|
||||
"github.com/Fluffy-Bean/lynxie/internal/color"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
|
@ -180,7 +180,7 @@ func registerE621(a *app.App) app.Callback {
|
|||
data.Posts[0].CreatedAt.Format(time.DateTime),
|
||||
),
|
||||
},
|
||||
Color: utils.ColorFromRGB(255, 255, 255),
|
||||
Color: color.RGBToDiscord(255, 255, 255),
|
||||
},
|
||||
Reference: h.Reference,
|
||||
})
|
|
@ -9,7 +9,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Fluffy-Bean/lynxie/app"
|
||||
"github.com/Fluffy-Bean/lynxie/utils"
|
||||
"github.com/Fluffy-Bean/lynxie/internal/color"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
|
@ -131,7 +131,7 @@ func registerAnimal(a *app.App) app.Callback {
|
|||
Image: &discordgo.MessageEmbedImage{
|
||||
URL: "attachment://animal.png",
|
||||
},
|
||||
Color: utils.ColorFromRGB(255, 255, 255),
|
||||
Color: color.RGBToDiscord(255, 255, 255),
|
||||
},
|
||||
Files: []*discordgo.File{
|
||||
{
|
|
@ -1,5 +0,0 @@
|
|||
package utils
|
||||
|
||||
func ColorFromRGB(r, g, b int) int {
|
||||
return (r << 16) + (g << 8) + b
|
||||
}
|
Loading…
Add table
Reference in a new issue