From 1d30a252770b6d00a303df01c9153cd454d958dd Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Thu, 21 Jul 2022 11:39:50 -0400 Subject: [PATCH] cowboy: rm the original message --- plugins/cowboy/cowboy.go | 4 +++- plugins/cowboy/cowboy_image.go | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/cowboy/cowboy.go b/plugins/cowboy/cowboy.go index fbb83f7..a377950 100644 --- a/plugins/cowboy/cowboy.go +++ b/plugins/cowboy/cowboy.go @@ -1,6 +1,7 @@ package cowboy import ( + "fmt" "regexp" "github.com/rs/zerolog/log" @@ -41,9 +42,10 @@ func (p *Cowboy) makeCowboy(r bot.Request) { log.Debug().Msgf("makeCowboy: %s", r.Values["what"]) base := p.c.Get("baseURL", "http://127.0.0.1:1337") u := base + "/cowboy/img/" + r.Values["what"] + p.b.Send(r.Conn, bot.Delete, r.Msg.Channel, r.Msg.ID) p.b.Send(r.Conn, bot.Message, r.Msg.Channel, "", bot.ImageAttachment{ URL: u, - AltTxt: r.Msg.Body, + AltTxt: fmt.Sprintf("%s: %s", r.Msg.User.Name, r.Msg.Body), Width: 64, Height: 64, }) diff --git a/plugins/cowboy/cowboy_image.go b/plugins/cowboy/cowboy_image.go index 4e15293..8c1f223 100644 --- a/plugins/cowboy/cowboy_image.go +++ b/plugins/cowboy/cowboy_image.go @@ -37,6 +37,7 @@ func getEmojy(c *config.Config, name string) (image.Image, error) { func getCowboyHat(c *config.Config) (image.Image, error) { emojyPath := c.Get("emojy.path", "emojy") p := path.Join(emojyPath, c.Get("cowboy.hatname", "hat.png")) + p = path.Clean(p) f, err := os.Open(p) if err != nil { return nil, err