Skip to content

Commit

Permalink
commands/tmplexec: also return *discordgo.MessageSend (#1662)
Browse files Browse the repository at this point in the history
Also return `*discordgo.MessageSend` after executing a command via a
fake message.

Commit 97b021d ("customcommands: link to ccs in cc command ") via
PR #1624 introduced a side effect where constructs such as
`{{ exec "cc" "1" }}` no longer worked, thus resulting in breakage.

This patch does *not* fully restore the former state, however seeing as
the aforementioned commit broke things in a very subtle way it seems
acceptable to introduce a new, different behaviour.
Admittedly, with the current state of in-built commands responding with
all sorts of things that may or may not be writable to a CC variable,
this only confuses things further, but at least it is working again(TM).

At some point in the future we could consider sorting these
"inconsistencies" out and making it "just werk" with custom commands. In
light of the currently ongoing migration from GORM to sqlboiler, this
undertaking does not seem too far-fetched.

Signed-off-by: Luca Zeuch <[email protected]>
  • Loading branch information
l-zeuch authored May 31, 2024
1 parent 647cce8 commit 37879f4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions commands/tmplexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ func execCmd(tmplCtx *templates.Context, dryRun bool, m *discordgo.MessageCreate
return v, nil
case []*discordgo.MessageEmbed:
return v, nil
case *discordgo.MessageSend:
return v, nil
}

return "", nil
Expand Down

0 comments on commit 37879f4

Please sign in to comment.