tappd: shorten the message on images

This commit is contained in:
Chris Sexton 2022-10-14 08:45:12 -04:00
parent e93b6d07ab
commit 435f45fa7c
1 changed files with 6 additions and 6 deletions

View File

@ -112,13 +112,13 @@ func (p *Tappd) registerDiscord(d *discord.Discord) {
func (p *Tappd) tap(s *discordgo.Session, i *discordgo.InteractionCreate) { func (p *Tappd) tap(s *discordgo.Session, i *discordgo.InteractionCreate) {
who := i.Interaction.Member.Nick who := i.Interaction.Member.Nick
channel := i.Interaction.ChannelID channel := i.Interaction.ChannelID
msg := fmt.Sprintf("%s checked in: %s", shortMsg := i.ApplicationCommandData().Options[1].StringValue()
i.Interaction.Member.Nick, longMsg := fmt.Sprintf("%s checked in: %s",
i.ApplicationCommandData().Options[1].StringValue()) i.Interaction.Member.Nick, shortMsg)
attachID := i.ApplicationCommandData().Options[0].Value.(string) attachID := i.ApplicationCommandData().Options[0].Value.(string)
attach := i.ApplicationCommandData().Resolved.Attachments[attachID] attach := i.ApplicationCommandData().Resolved.Attachments[attachID]
spec := defaultSpec() spec := defaultSpec()
spec.text = msg spec.text = shortMsg
info, err := p.getAndOverlay(attachID, attach.URL, []textSpec{spec}) info, err := p.getAndOverlay(attachID, attach.URL, []textSpec{spec})
if err != nil { if err != nil {
log.Error().Err(err).Msgf("error with interaction") log.Error().Err(err).Msgf("error with interaction")
@ -135,7 +135,7 @@ func (p *Tappd) tap(s *discordgo.Session, i *discordgo.InteractionCreate) {
return return
} }
embed := &discordgo.MessageEmbed{ embed := &discordgo.MessageEmbed{
Description: msg, Description: longMsg,
Image: &discordgo.MessageEmbedImage{ Image: &discordgo.MessageEmbedImage{
URL: info.BotURL, URL: info.BotURL,
Width: info.W, Width: info.W,
@ -152,7 +152,7 @@ func (p *Tappd) tap(s *discordgo.Session, i *discordgo.InteractionCreate) {
log.Error().Err(err).Msgf("error with interaction") log.Error().Err(err).Msgf("error with interaction")
return return
} }
err = p.log(who, channel, msg) err = p.log(who, channel, shortMsg)
if err != nil { if err != nil {
log.Error().Err(err).Msgf("error recording tap") log.Error().Err(err).Msgf("error recording tap")
} }