add !pm signature option

This commit is contained in:
Aine
2023-09-23 16:35:12 +03:00
parent 74defa85e4
commit 480c99cf79
5 changed files with 39 additions and 1 deletions

View File

@@ -99,6 +99,12 @@ func (b *Bot) initCommands() commandList {
allowed: b.allowOwner,
},
{allowed: b.allowOwner, description: "mailbox options"}, // delimiter
{
key: config.RoomSignature,
description: "Get or set signature of the room (markdown supported)",
sanitizer: func(s string) string { return s },
allowed: b.allowOwner,
},
{
key: config.RoomNoSend,
description: fmt.Sprintf(
@@ -523,6 +529,14 @@ func (b *Bot) runSend(ctx context.Context) {
htmlBody = format.RenderMarkdown(body, true, true).FormattedBody
}
signature := format.RenderMarkdown(cfg.Signature(), true, true)
if signature.Body != "" {
body += "\n\n---\n" + signature.Body
if htmlBody != "" {
htmlBody += "<br><hr><br>" + signature.FormattedBody
}
}
tos := strings.Split(to, ",")
// validate first
for _, to := range tos {