cowboy: rm the original message

This commit is contained in:
Chris Sexton 2022-07-21 11:39:50 -04:00 committed by Chris Sexton
parent f548f74be9
commit 1d30a25277
2 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package cowboy package cowboy
import ( import (
"fmt"
"regexp" "regexp"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
@ -41,9 +42,10 @@ func (p *Cowboy) makeCowboy(r bot.Request) {
log.Debug().Msgf("makeCowboy: %s", r.Values["what"]) log.Debug().Msgf("makeCowboy: %s", r.Values["what"])
base := p.c.Get("baseURL", "http://127.0.0.1:1337") base := p.c.Get("baseURL", "http://127.0.0.1:1337")
u := base + "/cowboy/img/" + r.Values["what"] 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{ p.b.Send(r.Conn, bot.Message, r.Msg.Channel, "", bot.ImageAttachment{
URL: u, URL: u,
AltTxt: r.Msg.Body, AltTxt: fmt.Sprintf("%s: %s", r.Msg.User.Name, r.Msg.Body),
Width: 64, Width: 64,
Height: 64, Height: 64,
}) })

View File

@ -37,6 +37,7 @@ func getEmojy(c *config.Config, name string) (image.Image, error) {
func getCowboyHat(c *config.Config) (image.Image, error) { func getCowboyHat(c *config.Config) (image.Image, error) {
emojyPath := c.Get("emojy.path", "emojy") emojyPath := c.Get("emojy.path", "emojy")
p := path.Join(emojyPath, c.Get("cowboy.hatname", "hat.png")) p := path.Join(emojyPath, c.Get("cowboy.hatname", "hat.png"))
p = path.Clean(p)
f, err := os.Open(p) f, err := os.Open(p)
if err != nil { if err != nil {
return nil, err return nil, err