do not react on edits and redactions, add section titles in help message
This commit is contained in:
@@ -68,7 +68,7 @@ func (b *Bot) initCommands() commandList {
|
||||
description: "Send email",
|
||||
allowed: b.allowSend,
|
||||
},
|
||||
{allowed: b.allowOwner}, // delimiter
|
||||
{allowed: b.allowOwner, description: "mailbox ownership"}, // delimiter
|
||||
// options commands
|
||||
{
|
||||
key: roomOptionMailbox,
|
||||
@@ -93,7 +93,7 @@ func (b *Bot) initCommands() commandList {
|
||||
description: "Get or set SMTP password of the room's mailbox",
|
||||
allowed: b.allowOwner,
|
||||
},
|
||||
{allowed: b.allowOwner}, // delimiter
|
||||
{allowed: b.allowOwner, description: "mailbox options"}, // delimiter
|
||||
{
|
||||
key: roomOptionNoSend,
|
||||
description: fmt.Sprintf(
|
||||
@@ -166,7 +166,7 @@ func (b *Bot) initCommands() commandList {
|
||||
sanitizer: utils.SanitizeBoolString,
|
||||
allowed: b.allowOwner,
|
||||
},
|
||||
{allowed: b.allowOwner}, // delimiter
|
||||
{allowed: b.allowOwner, description: "mailbox antispam"}, // delimiter
|
||||
{
|
||||
key: roomOptionSpamcheckMX,
|
||||
description: "only accept email from servers which seem prepared to receive it (those having valid MX records) (`true` - enable, `false` - disable)",
|
||||
@@ -188,7 +188,7 @@ func (b *Bot) initCommands() commandList {
|
||||
sanitizer: utils.SanitizeStringSlice,
|
||||
allowed: b.allowOwner,
|
||||
},
|
||||
{allowed: b.allowAdmin}, // delimiter
|
||||
{allowed: b.allowAdmin, description: "server options"}, // delimiter
|
||||
{
|
||||
key: botOptionAdminRoom,
|
||||
description: "Get or set admin room",
|
||||
@@ -231,7 +231,7 @@ func (b *Bot) initCommands() commandList {
|
||||
description: "Delete specific mailbox",
|
||||
allowed: b.allowAdmin,
|
||||
},
|
||||
{allowed: b.allowAdmin}, // delimiter
|
||||
{allowed: b.allowAdmin, description: "server antispam"}, // delimiter
|
||||
{
|
||||
key: botOptionGreylist,
|
||||
description: "Set automatic greylisting duration in minutes (0 - disabled)",
|
||||
@@ -361,7 +361,10 @@ func (b *Bot) sendHelp(ctx context.Context) {
|
||||
continue
|
||||
}
|
||||
if cmd.key == "" {
|
||||
msg.WriteString("\n---\n")
|
||||
msg.WriteString("\n---\n\n")
|
||||
msg.WriteString("#### ")
|
||||
msg.WriteString(cmd.description)
|
||||
msg.WriteString("\n")
|
||||
continue
|
||||
}
|
||||
msg.WriteString("* **`")
|
||||
|
||||
@@ -3,6 +3,8 @@ package bot
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"gitlab.com/etke.cc/postmoogle/utils"
|
||||
)
|
||||
|
||||
func (b *Bot) handle(ctx context.Context) {
|
||||
@@ -20,7 +22,7 @@ func (b *Bot) handle(ctx context.Context) {
|
||||
message := strings.TrimSpace(content.Body)
|
||||
cmd := b.parseCommand(message, true)
|
||||
if cmd == nil {
|
||||
if content.RelatesTo != nil {
|
||||
if utils.EventParent("", content) != "" {
|
||||
b.SendEmailReply(ctx)
|
||||
}
|
||||
return
|
||||
|
||||
@@ -32,16 +32,17 @@ func EventParent(currentID id.EventID, content *event.MessageEventContent) id.Ev
|
||||
return currentID
|
||||
}
|
||||
|
||||
if content.GetRelatesTo() == nil {
|
||||
relation := content.OptionalGetRelatesTo()
|
||||
if relation == nil {
|
||||
return currentID
|
||||
}
|
||||
|
||||
threadParent := content.RelatesTo.GetThreadParent()
|
||||
threadParent := relation.GetThreadParent()
|
||||
if threadParent != "" {
|
||||
return threadParent
|
||||
}
|
||||
|
||||
replyParent := content.RelatesTo.GetReplyTo()
|
||||
replyParent := relation.GetReplyTo()
|
||||
if replyParent != "" {
|
||||
return replyParent
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user