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